feat(configuration): 파일 API 공통 응답 규약 및 예외 처리 #26 - #58
Open
tlgms wants to merge 2 commits into
Hidden character warning
The head ref may contain hidden characters: "feat(document)-\ud30c\uc77c-\uc751\ub2f5-\uaddc\uc57d-#26"
Open
Conversation
명세의 성공/실패 응답 형식에 맞춘 ApiResponse envelope과 파일 관련 ErrorCode를 정의한다. 성공 응답에도 error 키를 항상 포함하고 timestamp는 실패 시에만 직렬화한다. 도메인 예외와 MaxUploadSizeExceededException을 명세의 HTTP 상태로 변환한다. 후자를 잡지 않으면 413이 아니라 500이 나간다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
명세의 응답 스키마에 대응하는 DTO와, 참조 ID(attachment_1 형태) 변환, MultipartFile→커맨드 변환 헬퍼를 추가한다. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
🚫 Excluded labels (none allowed) (2)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ApiResponseenvelope과ErrorCode를 정의합니다.@RestControllerAdvice를 추가합니다.Related Issue
Scope
configuration-adapter-in의common/document.dto패키지Implementation
API 공통 규약 §12가 "서비스마다 다른 응답 형식 사용"과 "에러 메시지만 반환하고 에러 코드 생략"을 금지합니다.
ApiResponse<T>error키를 항상 포함합니다. 개별 API 명세가 전부"error": null을 보여주고 있고, 클라이언트 파싱도 단순해집니다timestamp는 실패 시에만 직렬화합니다 (@get:JsonInclude(NON_NULL))DocumentExceptionHandlerInvalidFileFormatExceptionINVALID_FILE_FORMATInvalidFileNameException, 파라미터 누락INVALID_REQUEST_PARAMFileDocumentNotFoundExceptionFILE_NOT_FOUNDFileTooLargeException,MaxUploadSizeExceededExceptionFILE_TOO_LARGEStorageUploadFailedExceptionSTORAGE_UPLOAD_FAILEDPresignFailedExceptionPRESIGN_FAILEDMaxUploadSizeExceededException을 잡지 않으면 용량 초과 시 명세의 413이 아니라 500이 나갑니다. 이것 때문에 핸들러에 포함했습니다.헬퍼
FileReferenceId—attachment_1형태의 참조 ID ↔filesPK 변환MultipartFileExtensions— 확장자 검증, 커맨드 변환Testing
Deployment Notes
@RestControllerAdvice가 configuration 서비스 전역에 적용됩니다. 기존 gRPC 어댑터에는 영향이 없지만, 향후 다른 REST 컨트롤러가 추가되면 이 핸들러를 공유하게 됩니다Checklist
리뷰 시 봐주셨으면 하는 것
ApiResponse를packages/common으로 뺄지 — 다른 서비스도 같은 envelope이 필요합니다. 다만 공유 패키지 신설은 이슈 범위를 넘어 지금은configuration-adapter-in에 두었습니다. 두 번째 서비스가 필요해지는 시점에 추출을 권합니다.HttpStatus.CONTENT_TOO_LARGE—PAYLOAD_TOO_LARGE가 deprecated라 교체했습니다.itemsvsapplicants, page 1-base vs 0-base). Document에는 목록 API가 없어 이 PR에는 영향이 없지만, 명세 정정이 필요합니다.