Swagger 3.0에서 OpenAPI로 변환하기
springfox에서 제공하는 swagger 관리 라이브러리 -> springfox-swagger
sprongdocs에서 제공하는 swagger 관리 라이브러리 -> springdoc-openapi
swagger에서 사용하는 파라미터들 설명
https://bcp0109.tistory.com/326
Spring Boot Swagger 3.x 적용
1. Swagger 란? Swagger 는 OAS(Open Api Specification)를 위한 프레임워크입니다. 개발자들의 필수 과제인 API 문서화를 쉽게 할 수 있도록 도와주며, 파라미터를 넣어서 실제로 어떤 응답이 오는지 테스트도
bcp0109.tistory.com
migration 방법
https://springdoc.org/migrating-from-springfox.html
Migrating from SpringFox
Remove springfox and swagger 2 dependencies. Add springdoc-openapi-ui dependency instead. org.springdoc springdoc-openapi-ui 1.6.10 Replace swagger 2 annotations with swagger 3 annotations (it is already included with springdoc-openapi-ui dependency). Pack
springdoc.org
- @ApiOperation(value = "foo", notes = "bar", tags = {"taggg"})→@Operation(summary = "foo", description = "bar", tags = {"taggg"})
- @ApiImplicitParam → @Parameter
- @ApiImplicitParams → @Parameters
@Parameters({
@Parameter(in = ParameterIn.QUERY
, description = "Page you want to retrieve (0..N)"
, name = "page"
, content = @Content(schema = @Schema(type = "integer", defaultValue = "0"))),
@Parameter(in = ParameterIn.QUERY
, description = "Number of records per page."
, name = "size"
, content = @Content(schema = @Schema(type = "integer", defaultValue = "20"))),
@Parameter(in = ParameterIn.QUERY
, description = "Sorting criteria in the format: property(,asc|desc). "
+ "Default sort order is ascending. " + "Multiple sort criteria are supported."
, name = "sort"
, content = @Content(array = @ArraySchema(schema = @Schema(type = "string"))))
})
Spring-doc 여러가지 질문들
https://springdoc.org/faq.html
F.A.Q
The whole idea of springdoc-openapi is to get your documentation the closest to the code, with minimal code changes. If the code contains @Deprecated, sprindoc-openapi will consider its schema as Deprecated as well. If you want to declare a field on swagge
springdoc.org