Skip to content

fix: 중복 JSON 키 요청의 500 오류 방지 - #2369

Merged
taejinn merged 1 commit into
developfrom
fix/2368-json-duplicate-key
Aug 31, 2026
Merged

fix: 중복 JSON 키 요청의 500 오류 방지#2369
taejinn merged 1 commit into
developfrom
fix/2368-json-duplicate-key

Conversation

@taejinn

@taejinn taejinn commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

🔍 개요

  • 중복 JSON 키가 포함된 모집글 요청이 필드 순서에 따라 마지막 값으로 처리되거나 500 오류를 반환하던 문제를 수정합니다.
  • Spring MVC 요청 파서에서 중복 키를 일관되게 거부하고 기존 NOT_READABLE_HTTP_MESSAGE 400 응답 경로를 사용합니다.

🚀 주요 변경 내용

  • MVC Jackson converter를 strict duplicate detection이 활성화된 복사본으로 같은 위치에서 교체했습니다.
  • Boot HttpMessageConvertersRestTemplate이 공유하는 원본 converter 및 ObjectMapper는 변경하지 않습니다.
  • converter 순서, supported media types, default charset, Jackson module 구성을 보존하고 예상하지 못한 subclass는 fail-fast 처리합니다.
  • POST/PUT 각각 두 가지 중복 키 순서를 400으로 처리하고 DB 상태가 바뀌지 않는 회귀 테스트를 추가했습니다.

💬 참고 사항

  • 변경 전 재현 결과는 키 순서에 따라 POST 201/500, PUT 200/500이었습니다.
  • 변경 후 네 경우 모두 400 NOT_READABLE_HTTP_MESSAGE를 반환합니다.
  • multipart 내부 JSON part 및 별도 custom JSON converter는 현재 적용 범위에 포함하지 않습니다.
  • ./gradlew test --no-daemon 전체 테스트를 통과했습니다.

✅ Checklist (완료 조건)

  • 코드 스타일 가이드 준수
  • 테스트 코드 포함됨
  • Reviewers / Assignees / Labels 지정 완료
  • 보안 및 민감 정보 검증 (API 키, 환경 변수, 개인정보 등)

Summary by CodeRabbit

  • Bug Fixes

    • Duplicate JSON keys are now rejected with a clear 400 error instead of being silently accepted.
    • Invalid recruitment creation or updates no longer modify existing recruitment, role, chat room, or member data.
  • Tests

    • Added coverage for duplicate keys in different JSON positions.
    • Added validation for preserving existing request and response conversion behavior.

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7c82e544-14fa-414f-ab27-723c6aa71560

📥 Commits

Reviewing files that changed from the base of the PR and between ebe98ca and 2fd807b.

📒 Files selected for processing (4)
  • src/main/java/in/koreatech/koin/global/config/WebConfig.java
  • src/test/java/in/koreatech/koin/acceptance/domain/TeamRecruitmentArticleContractApiTest.java
  • src/test/java/in/koreatech/koin/acceptance/domain/TeamRecruitmentArticleFlowApiTest.java
  • src/test/java/in/koreatech/koin/global/config/WebConfigTest.java

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Duplicate JSON key handling

Layer / File(s) Summary
Strict Jackson converter replacement
src/main/java/in/koreatech/koin/global/config/WebConfig.java, src/test/java/in/koreatech/koin/global/config/WebConfigTest.java
WebConfig replaces standard Jackson converters with strict copies. The tests verify duplicate-key detection, preserved settings, non-mutated originals, and subclass rejection.
Duplicate-key rejection on recruitment creation
src/test/java/in/koreatech/koin/acceptance/domain/TeamRecruitmentArticleContractApiTest.java
Creation requests with duplicate role name keys return NOT_READABLE_HTTP_MESSAGE and create no recruitment graph rows.
Duplicate-key rejection on recruitment updates
src/test/java/in/koreatech/koin/acceptance/domain/TeamRecruitmentArticleFlowApiTest.java
Update requests with duplicate role name keys return NOT_READABLE_HTTP_MESSAGE and preserve recruitment and role data.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 2fd80

Duplicate JSON keys now receive the existing 400 error response before recruitment data is changed, while unrelated converter behavior remains unchanged. No actionable merge-blocking risk remains.

Suggested reviewers: dnjswldnd-3513, insik03

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant SpringMVC
  participant StrictJacksonConverter
  participant ObjectMapper
  Client->>SpringMVC: Submit recruitment JSON
  SpringMVC->>StrictJacksonConverter: Deserialize request body
  StrictJacksonConverter->>ObjectMapper: Parse JSON with strict duplicate detection
  ObjectMapper-->>SpringMVC: Reject duplicate role name key
  SpringMVC-->>Client: Return 400 NOT_READABLE_HTTP_MESSAGE
Loading
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 25 functions across 4 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The implementation applies strict duplicate-key detection to copied Spring MVC Jackson converters, preserves the original converters and ObjectMappers, and adds regression tests for POST and PUT reque…
Out of Scope Changes check ✅ Passed The changes are limited to the WebConfig converter replacement and related unit and acceptance tests. They directly support the linked issue objectives and do not introduce unrelated code changes.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목은 중복 JSON 키 요청의 500 오류를 방지하는 주요 변경 사항을 정확하고 간결하게 설명합니다.
Full details: Linked Issues check

Explanation

The implementation applies strict duplicate-key detection to copied Spring MVC Jackson converters, preserves the original converters and ObjectMappers, and adds regression tests for POST and PUT requests. The tests verify 400 NOT_READABLE_HTTP_MESSAGE responses and unchanged database state for both duplicate-key orders. These changes satisfy the requirements in [#2368].

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/2368-json-duplicate-key

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added 공통 백엔드 공통으로 작업할 이슈입니다. 버그 정상적으로 동작하지 않는 문제상황입니다. labels Aug 30, 2026
@taejinn taejinn self-assigned this Aug 30, 2026
@github-actions

Copy link
Copy Markdown

Unit Test Results

1 043 tests   1 040 ✔️  2m 6s ⏱️
   240 suites         3 💤
   240 files           0

Results for commit 2fd807b.

@taejinn
taejinn marked this pull request as ready for review August 30, 2026 15:55

@dnjswldnd-3513 dnjswldnd-3513 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드 확인했습니다!

@taejinn
taejinn merged commit 97c3af7 into develop Aug 31, 2026
10 checks passed
@taejinn
taejinn deleted the fix/2368-json-duplicate-key branch August 31, 2026 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

공통 백엔드 공통으로 작업할 이슈입니다. 버그 정상적으로 동작하지 않는 문제상황입니다.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[공통] 중복 JSON 키 요청의 500 오류 방지

2 participants