[Fix] CourseInfo schema 이름 충돌 분리#148
Conversation
MountainDetailResponse.CourseInfo 와 NearbyMountainResponse.CourseInfo 가 같은 simple name 으로 OpenAPI schema 트리에서 충돌해 startName/endName 등 추가된 필드가 swagger 에 노출되지 않던 문제를 @Schema(name) 명시로 해결.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL 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)
Comment |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 서로 다른 DTO 클래스 내에 존재하는 동일한 이름의 CourseInfo 레코드가 OpenAPI(Swagger) 스키마 생성 시 충돌을 일으켜 일부 필드가 누락되던 문제를 해결합니다. 각 레코드에 고유한 스키마 이름을 부여함으로써 문서화의 정확성을 높였습니다. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces @Schema annotations to the inner CourseInfo records in MountainDetailResponse and NearbyMountainResponse to prevent Swagger schema name conflicts. The reviewer suggests configuring springdoc.use-fully-qualified-model-names: true globally to avoid manual annotations. Additionally, the reviewer recommends implementing the existing ascent, descent, and maxAltitude fields in the DTOs to resolve an outdated TODO comment.
| } | ||
| } | ||
|
|
||
| @Schema(name = "MountainDetailCourseInfo") |
There was a problem hiding this comment.
[P3] Springdoc 전역 설정을 통한 스키마 이름 충돌 해결 제안
문제점:
현재는 CourseInfo와 같이 동일한 이름을 가진 내부 클래스(record)의 스키마 충돌을 방지하기 위해 각 DTO마다 @Schema(name = "...") 어노테이션을 수동으로 추가하고 있습니다. 이 방식은 새로운 DTO가 추가될 때마다 충돌을 수동으로 감지하고 어노테이션을 누락 없이 작성해야 하므로 유지보수성이 떨어집니다.
해결 방안:
application.yml (또는 application.properties) 설정에 아래 옵션을 추가하면, Springdoc이 자동으로 정규화된 클래스 이름(Fully Qualified Class Name)을 사용하여 스키마를 생성하므로 어노테이션 없이도 충돌을 전역적으로 방지할 수 있습니다.
springdoc:
use-fully-qualified-model-names: true이 설정을 적용하면 현재 추가된 @Schema(name = "MountainDetailCourseInfo") 및 @Schema(name = "NearbyMountainCourseInfo") 어노테이션을 제거할 수 있어 코드가 더 깔끔해집니다.
| * 시안의 코스 카드에 표시되는 정보 중 현재 도메인 모델로 채울 수 있는 것만 포함. | ||
| * TODO: ascent / descent / maxAltitude 컬럼이 Course 에 추가되면 함께 노출. | ||
| */ | ||
| @Schema(name = "NearbyMountainCourseInfo") |
There was a problem hiding this comment.
[P2] 이미 추가된 Course 엔티티 필드 반영 및 TODO 제거 제안
문제점:
주석에 TODO: ascent / descent / maxAltitude 컬럼이 Course 에 추가되면 함께 노출이라고 명시되어 있으나, 현재 Course 엔티티에는 이미 ascent, descent, maxAltitude 필드가 구현되어 있습니다.
해결 방안:
해당 필드들을 NearbyMountainResponse.CourseInfo DTO에 추가하여 프론트엔드에 노출하고, 아웃데이트된 TODO 주석을 제거하거나 업데이트하는 것이 좋습니다.
동일하게 MountainDetailResponse.CourseInfo에도 해당 필드들을 추가하는 것을 검토해 주세요.
🧾 요약
🔗 이슈
✨ 변경 내용
✅ 확인