Programing/API

Swagger Springboot 3.x application.yml, properties 설정 옵션

리커니 2024. 3. 25.
반응형

Swagger Springboot 3.x application.yml, properties 설정 옵션입니다.

 

Swagger 의 다양한 설정 방법은 아래의 Link를 확인하세요!

 

Link : https://aljjabaegi.tistory.com/713

 

Swagger Springboot 3.x 의존성 주입 및 Information 설정, 기본 설정

Swagger Springboot 3.x 의존성 주입 및 Information 설정, 초기 세팅 방법입니다. 의존성 추가 Gradle 에 Spring-web starter 와 Swagger dependency를 추가합니다. dependencies { implementation 'org.springframework.boot:spring-boot-sta

aljjabaegi.tistory.com

 

Link : https://aljjabaegi.tistory.com/714

 

Swagger Springboot 3.x Operation 설정 방법

Swagger Springboot 3.x Operation 설정 방법입니다. 초기 설정 방법은 아래의 Link를 확인하세요. Link : https://aljjabaegi.tistory.com/713 Swagger Springboot 3.x 의존성 주입 및 Information 설정, 기본 설정 Swagger Springboot 3

aljjabaegi.tistory.com

 

Link : https://aljjabaegi.tistory.com/715

 

Swagger Springboot 3.x Response 설정 방법

Swagger Springboot 3.x Response 설정 방법입니다. 초기 설정과 Operation 설정은 아래의 Link를 확인하세요. Link : https://aljjabaegi.tistory.com/713 Swagger Springboot 3.x 의존성 주입 및 Information 설정, 기본 설정 Swagger

aljjabaegi.tistory.com

 

Link : https://aljjabaegi.tistory.com/717

 

Swagger Springboot 3.x JWT 인증 적용 방법

Swagger Springboot 3.x JWT 인증 적용 방법입니다. Swagger 초기 설정 및 Operation, Response, application.properties 관련 방법은 아래의 Link를 확인하세요! Link : https://aljjabaegi.tistory.com/713 Swagger Springboot 3.x 의존성

aljjabaegi.tistory.com

 

Link : https://aljjabaegi.tistory.com/718

 

Swagger Springboot 3.x Grouping 방법

Swagger Springboot 3.x Grouping 방법입니다. Swagger에 대한 다양한 설정 방법은 아래의 Link를 확인하세요! Link : https://aljjabaegi.tistory.com/713 Swagger Springboot 3.x 의존성 주입 및 Information 설정, 기본 설정 Swagger

aljjabaegi.tistory.com

 

Spring Properties 설정 가능 옵션

Link : https://springdoc.org/#swagger-ui-properties

 

OpenAPI 3 Library for spring-boot

Library for OpenAPI 3 with spring boot projects. Is based on swagger-ui, to display the OpenAPI description.Generates automatically the OpenAPI file.

springdoc.org

 

properties에서 설정가능한 다양한 정보는 위의 Link를 참고하시고, 이중에 유용한 몇가지에 대해서 알아보겠습니다.

 

Operation 접은 상태로 초기화

 

기본적으로 모든 Operation tree 가 펼쳐진 상태가 default 입니다.

doc-expansion: none 옵션을 주어 접혀진 상태로 초기화 할 수 있습니다.

springdoc:
  swagger-ui:
      doc-expansion: none

 

API 요청에 걸린 시간 표출

display-request-duration: true 옵션으로 요청에 걸린 시간을 표출할 수 있습니다.

springdoc:
  swagger-ui:
      display-request-duration: true

 

Tag 검색 기능 추가

filter: true 옵션을 주어 Tag 조회 영역을 추가할 수 있습니다.

springdoc:
  swagger-ui:
      filter: true

 

바로 테스트가 가능하도록 설정

원래는 try it out 버튼을 클릭해서 테스트가 요청이 가능했는데, try-it-out-enable: true 옵션을 설정하면 

try it out 버튼을 누른 상태로 초기화가 됩니다.

 

default 설정 시

 

try-it-out-enable: true 설정 시

정렬 관련

Operation 정렬

tag 내 operation의 정렬은 operations-sorter: alpha/method 로 설정할 수 있습니다.

'alpha' 일 경우 알파벳순으로 정렬 (URI 포함) 합니다.

 

'method' 일 경우 DELETE → GET → POST → PUT 순으로 정렬해 줍니다.

 

Github Swagger Project

https://github.com/aljjabaegiProgrammer/swagger-api

 

GitHub - aljjabaegiProgrammer/swagger-api: swagger API project

swagger API project. Contribute to aljjabaegiProgrammer/swagger-api development by creating an account on GitHub.

github.com

 

반응형

댓글

💲 추천 글