docs: Swagger(OpenAPI) API 문서 도입 - #214
Merged
Merged
Conversation
springdoc-openapi를 추가하고 전체 REST 컨트롤러에 @Tag/@operation을 붙여 /swagger-ui에서 실제 코드 기준 API 문서를 바로 확인할 수 있게 한다. Closes #213
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.
변경 내용
springdoc-openapi-starter-webmvc-ui:2.8.6의존성 추가OpenApiConfig추가Authorization: Bearer인증 스킴(bearerAuth) 등록global.error.ErrorResponse) 스키마를 명시적으로 등록하고,OperationCustomizer로 전체 오퍼레이션에4XX/5XX공통 에러 응답을 전역 부여 (예외 핸들러가 던지는 응답이라 컨트롤러 반환 타입만으로는 springdoc이 알 수 없어서 수동 등록 필요)SecurityConfig는 별도 수정 없음 —/v3/api-docs,/swagger-ui/**는 기존anyRequest().permitAll()캐치올로 이미 접근 가능PolicyChatMessageController제외)에 클래스 레벨@Tag, 메서드 레벨@Operation(summary, description)추가description은 기존 Javadoc이 있으면 그 내용을 재사용, 없으면 새로 작성 (기존 Javadoc은 삭제하지 않고 유지)ApiResponse<T>제네릭)과 요청 DTO(Bean Validation 포함)는 springdoc이 컨트롤러 시그니처에서 자동으로 정확히 추론하므로 별도 어노테이션 없이도 이미 스키마에 반영됨을 확인검증
./gradlew spotlessApply→./gradlew compileJava→./gradlew test spotlessCheck모두 통과/v3/api-docs: 25개 태그, 61개 오퍼레이션 전부에 summary +200/4XX/5XX응답 존재,ErrorResponse/FieldErrorDetail스키마 정상 등록ApiResponseListPolicyCardResponse처럼 제네릭T별로 스키마가 정확히 분리되어 있음 확인PolicyApplicationCreateRequest등에서@Pattern/@Size/필수값이pattern/maxLength/required로 정확히 반영됨 확인/swagger-ui/index.html: 브라우저에서 태그 그룹/summary/description 정상 렌더링, JWT Authorize 버튼 동작 확인연결 이슈
Closes #213