Skip to content
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

[fix] #282 - Swagger 그룹화를 코드 기반 설정으로 변경 #283

Merged
merged 1 commit into from
Dec 3, 2024

Conversation

hoonyworld
Copy link
Member

@hoonyworld hoonyworld commented Dec 3, 2024

Related issue 🛠

Work Description ✏️

  • Swagger 그룹화를 코드 기반 설정으로 변경하였습니다.
  • 코드에서 GroupedOpenApi.builder()를 사용해서, 경로 매칭뿐 아니라 추가적인 커스터마이징 로직을 직접 정의하였습니다.
  • 또한, 스웨거 접속 시 admin 그룹을 default로 보여줘서, general 그룹을 default로 보여주도록 변경하였습니다.

Trouble Shooting ⚽️

OperationCustomizer와 YAML의 한계

  • springdoc.group-configs를 통해 YAML에서 그룹을 정의하면, SpringDoc이 해당 경로 설정에 맞는 그룹을 자동으로 생성합니다.
  • 하지만 YAML 기반의 그룹 생성 과정에서는 추가적인 OperationCustomizer나 다른 커스터마이징 로직이 적용되지 않는 것을 확인했습니다.
    • 즉, 그룹 설정이 SpringDoc 내부에서 처리되며, 사용자 정의 OperationCustomizer를 연결할 수 없어서 코드에서 명시적으로 등록한 경우에만 동작하는 것 같습니다.
  • 그래서 springdoc.group-configs는 단순히 경로 매칭에 따라 그룹을 생성할 뿐, 사용자 정의 로직을 추가할 수 없으므로 @DisableSwaggerSecurity와 같은 커스텀 어노테이션도 작동하지 않았던 것입니다.

Related ScreenShot 📷

image
  • 토큰이 필요하지 않는 API의 경우 좌물쇠가 사라지는 것을 확인했습니다.

Uncompleted Tasks 😅

To Reviewers 📢

Copy link
Collaborator

@hyerinhwang-sailin hyerinhwang-sailin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yml로 설정할 경우 customize가 덮이는 군요!! 트러블 슈팅 고생하셨습니다👍👍

@hoonyworld hoonyworld merged commit 1bc1520 into develop Dec 3, 2024
1 check passed
@hoonyworld hoonyworld deleted the bug/#282 branch December 3, 2024 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[bug] @DisableSwaggerSecurity 어노테이션이 적용되지 않는 문제
2 participants