feat(S15P11A705-53): 공통 응답 봉투(ApiResponse) 적용 - #26
Merged
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… mapper Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
api-conventions.md wrongly described list pagination as page/size/sort while the response used cursors, contradicting spec §1.4 (cursor+size only, no sort). BD-03 claimed the envelope deepens the OpenAPI schema, but ApiResponseBodyAdvice wraps at runtime while springdoc introspects declared controller types with no OperationCustomizer/ModelConverter, so the schema actually diverges from the real response instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-response-envelope # Conflicts: # docs/backend/WORKLOG.md # docs/backend/decisions/README.md # docs/backend/implements/README.md
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
cherry-go-round
approved these changes
Jul 27, 2026
Contributor
Author
추가: OpenAPI 스키마 정합 (Task 5,
|
"봉투"는 envelope의 직역으로 어색해 문서·주석 전반에서 envelope로 바꿨다. 계약·동작 변경은 없다. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
10 tasks
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.
요약
성공·오류 응답을 같은 봉투로 통일합니다. 클라이언트는
success하나로 분기합니다. 도메인 컨트롤러는 DTO를 그대로 반환하고ResponseBodyAdvice가 감쌉니다.{ "success": true, "data": { … } } { "success": false, "error": { "code": "…", "message": "…", "fieldErrors": [], "traceId": "…" } }Jira: S15P11A705-53 — https://ssafy.atlassian.net/browse/S15P11A705-53
함께 머지 필요: 명세 PR Team-PinLog/docs#11 (§1.6 봉투 정의, §1.5 오류+traceId, §11.0 타입)
res.items→res.data.items,res.code→res.error.code. FE와 동시 배포가 필요합니다.변경 사항
global/response/ApiResponse<T>— record{success, data, error}+ok(T)/fail(ErrorResponse).@JsonInclude(NON_NULL)로 성공에error키·오류에data키가 나오지 않음. 성공 쪽에message필드 없음.global/web/ApiResponseBodyAdvice— 세 조건 모두 만족할 때만 감쌈: ① 컨트롤러가com.pinlog.pinlogback.domain하위 ② 반환형이 이미ApiResponse가 아님 ③ Jackson 컨버터.body == null이면 그대로 통과(204 유지), 이미 봉투면 이중 감싸기 없음.GlobalExceptionHandler— 4분기를ApiResponse.fail(...)로. 상태 코드·ErrorCode 선택·로깅 레벨은 불변.ErrorResponse는 구조 변경 없이 재사용(error본문).api-conventions.md·error-handling.md갱신, BD-03(결정), BI-03(구현 리포트), WORKLOG.설계: URL 패턴이 아니라 컨트롤러 패키지로 판정
actuator(
org.springframework.boot.actuate.*)·springdoc(org.springdoc.*)은 도메인 패키지가 아니므로 자동으로 제외됩니다. URL 제외 목록을 관리하는 방식과 달리 default-deny라, 새 서드파티 핸들러가 들어와도 감싸지지 않습니다. 감쌌다면 배포 헬스체크와 Swagger UI가 깨집니다.테스트 / 검증
./gradlew clean check --no-daemonBUILD SUCCESSFUL (25 tests, 0 failures)DeploymentContractTests(actuator health가 봉투 없이{"status":"UP"}, 미매핑 URL 404) ·OpenApiDocsTests(/v3/api-docs200 + 유효 OpenAPI)ResponseEntity<Void>·직접 호출로 null 분기 실증(분기를 깨면 실패함을 확인){success:false, error:{…}},error.traceId존재, 상태 코드 불변, 500이 내부 정보 미노출tools.jackson)로 검증리뷰 중 잡아낸 것 (기록용)
AbstractJackson2HttpMessageConverter(Jackson 2 이름)는 이 프로젝트에서 절대 매칭되지 않아 Advice가 영구 무동작이 될 수 있었습니다. 실제 상위 타입AbstractJacksonHttpMessageConverter(Jackson 3)로 정정했습니다.미결 / 후속 (티켓 필요)
OperationCustomizer/ModelConverter를 넣어야 문서와 실제 응답이 일치합니다(현재는 도메인 엔드포인트가 없어 영향 0)./error폴백은@RestControllerAdvice를 거치지 않으므로 인증 PR에서 직접ApiResponse.fail(...)을 만들어야 합니다(error-handling.md에 명기).error.impact(409 DELETE_CONFIRMATION_REQUIRED) — 명세에는 있으나 미구현. Record 삭제 티켓에서ErrorResponse확장점과 함께 도입.supports()의 패키지 판정이startsWith라domainsupport같은 형제 패키지도 매칭(현재 그런 패키지 없음),ErrorResponse에@JsonInclude(NON_NULL)없음(async 경로에서traceId: null가능).