Skip to content

Conversation

@minjee2758
Copy link
Collaborator

@minjee2758 minjee2758 commented Dec 12, 2025

작업 내용

  • 문제 등록/수정 API에서 multipart/form-data 요청 시 필수값 검증 오류가 발생하는 문제 수정
  • Swagger에서 폼데이터로 요청 시 @NotNull, @notblank 검증 에러가 발생하던 이슈 해결

변경 사항

  • ProblemAdminController.createProblem() 메서드의 @RequestPart에 name 속성 추가
    • @RequestPart @Valid ProblemCreateRequest → @RequestPart("request") @Valid ProblemCreateRequest
  • ProblemAdminController.modifyProblem() 메서드의 @RequestPart에 name 속성 추가
    • @RequestPart @Valid ProblemUpdateRequest → @RequestPart("request") @Valid ProblemUpdateRequest

트러블 슈팅

  • 문제: Swagger에서 multipart/form-data 형식으로 문제 등록 요청 시 모든 필드에 값을 넣어도 필수값 에러 발생
  • 원인: @RequestPart에 name 속성이 명시되지 않아 Spring이 요청 데이터를 바인딩하지 못함. 결과적으로 모든 필드가 null로 들어와 @NotNull, @notblank 검증 실패
  • 해결: @RequestPart에 명시적으로 name 속성("request")을 추가하여 multipart 파트명과 매핑되도록 수정

Summary by CodeRabbit

릴리스 노트

  • 개선사항
    • 요청 파라미터 처리 정확성 개선으로 API 안정성 향상

참고: 본 업데이트는 주로 내부 기술적 개선사항을 포함하며, 최종 사용자에게 직접적인 기능 변화는 없습니다.

✏️ Tip: You can customize this high-level summary in your review settings.

@minjee2758 minjee2758 self-assigned this Dec 12, 2025
@coderabbitai
Copy link

coderabbitai bot commented Dec 12, 2025

Walkthrough

ProblemAdminController의 두 개 메서드에서 @RequestPart 애노테이션을 명시적으로 부분 이름 "request"를 지정하도록 업데이트했습니다. createProblem과 modifyProblem 메서드의 요청 매개변수 바인딩이 변경되었습니다.

Changes

Cohort / File(s) Summary
Request Part 애노테이션 명시화
src/main/java/org/ezcode/codetest/presentation/problemmanagement/problem/ProblemAdminController.java
createProblem 메서드의 @RequestPart@RequestPart("request")로 변경하여 부분 이름을 명시적으로 지정. modifyProblem 메서드의 @RequestPart를 동일하게 @RequestPart("request")로 업데이트.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • 단일 파일에서 애노테이션만 변경된 일관된 패턴
  • 메서드 시그니처는 유지되고 바인딩 명시성만 강화
  • 로직 변경 없음, 순수 구성 업데이트

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • NCookies
  • chat26666
  • pokerbearkr
  • thezz9

Poem

🐰 요청 부분의 이름을 명시하니,
매개변수 바인딩이 더욱 맑아지고,
컨트롤러는 자신의 뜻을 분명히 전하네.
작은 변화가 큰 명확함을 낳으니,
코드의 의도는 더욱 빛나리라! ✨

Pre-merge checks and finishing touches

❌ 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%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 제목이 변경사항의 주요 내용과 관련이 있습니다. 어드민 문제 추가/수정 API의 @RequestPart 어노테이션에 명시적 이름을 추가하는 리팩토링입니다.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/admin-problem-post

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34c899a and d25be84.

📒 Files selected for processing (1)
  • src/main/java/org/ezcode/codetest/presentation/problemmanagement/problem/ProblemAdminController.java (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build
🔇 Additional comments (2)
src/main/java/org/ezcode/codetest/presentation/problemmanagement/problem/ProblemAdminController.java (2)

59-59: LGTM! createProblem과 동일한 수정 적용

@RequestPart("request") 명시적 이름 지정이 올바르게 적용되었습니다. 파일 내 모든 @RequestPart 애노테이션(라인 44, 45, 59, 60, 75)이 명시적 이름을 가지므로 일관성이 유지됩니다. 두 멀티파트 엔드포인트(createProblem과 modifyProblem)가 동일한 규칙을 따르고 있어 올바른 구현입니다.


44-44: 멀티파트 바인딩 문제 해결을 위한 명시적 파트 이름 지정

@RequestPart("request") 명시적 이름 지정으로 multipart/form-data 요청의 바인딩 문제를 올바르게 해결합니다. 이는 Spring이 멀티파트 부분을 DTO에 매핑할 수 있도록 보장하며, @RequestPart(value = "image", required = false)와의 일관성도 유지합니다.

API 클라이언트가 멀티파트 요청 시 "request"라는 파트 이름을 사용하고 있는지 확인하세요.


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 and usage tips.

@minjee2758 minjee2758 merged commit 1c0d96a into dev Dec 12, 2025
2 checks passed
@minjee2758 minjee2758 deleted the refactor/admin-problem-post branch December 12, 2025 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants