-
Notifications
You must be signed in to change notification settings - Fork 0
[Fix] CourseInfo schema 이름 충돌 분리 #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| import com.semosan.api.domain.mountain.entity.Course; | ||
| import com.semosan.api.domain.mountain.entity.Mountain; | ||
| import com.semosan.api.domain.mountain.enums.Difficulty; | ||
| import io.swagger.v3.oas.annotations.media.Schema; | ||
|
|
||
| import java.util.List; | ||
|
|
||
|
|
@@ -44,6 +45,7 @@ public static NearbyMountainInfo from(Mountain mountain) { | |
| * 시안의 코스 카드에 표시되는 정보 중 현재 도메인 모델로 채울 수 있는 것만 포함. | ||
| * TODO: ascent / descent / maxAltitude 컬럼이 Course 에 추가되면 함께 노출. | ||
| */ | ||
| @Schema(name = "NearbyMountainCourseInfo") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P2] 이미 추가된 Course 엔티티 필드 반영 및 TODO 제거 제안 문제점: 해결 방안: 동일하게 |
||
| public record CourseInfo( | ||
| Long courseId, | ||
| String name, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P3] Springdoc 전역 설정을 통한 스키마 이름 충돌 해결 제안
문제점:
현재는
CourseInfo와 같이 동일한 이름을 가진 내부 클래스(record)의 스키마 충돌을 방지하기 위해 각 DTO마다@Schema(name = "...")어노테이션을 수동으로 추가하고 있습니다. 이 방식은 새로운 DTO가 추가될 때마다 충돌을 수동으로 감지하고 어노테이션을 누락 없이 작성해야 하므로 유지보수성이 떨어집니다.해결 방안:
application.yml(또는application.properties) 설정에 아래 옵션을 추가하면, Springdoc이 자동으로 정규화된 클래스 이름(Fully Qualified Class Name)을 사용하여 스키마를 생성하므로 어노테이션 없이도 충돌을 전역적으로 방지할 수 있습니다.이 설정을 적용하면 현재 추가된
@Schema(name = "MountainDetailCourseInfo")및@Schema(name = "NearbyMountainCourseInfo")어노테이션을 제거할 수 있어 코드가 더 깔끔해집니다.