implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2'
package org.zerock.b01.config;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import lombok.RequiredArgsConstructor;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@OpenAPIDefinition(
info = @Info(title = "Zerock App",version = "v1"))
@RequiredArgsConstructor
@Configuration
public class SwaggerConfig {
@Bean
public GroupedOpenApi chatOpenApi() {
String[] paths = {"/**"};
return GroupedOpenApi.builder()
.group("Zerock OPEN API v1")
.pathsToMatch(paths)
.build();
}
}
spring-openapi로 변경이 되면서 import도 수정
import io.swagger.v3.oas.annotations.Operation;
기존 어노테이션들도 변경이 필요하다
@Api → @Tag
@ApiIgnore → @Parameter(hidden = true) or @Operation(hidden = true) or @Hidden
@ApiImplicitParam → @Parameter
@ApiImplicitParams → @Parameters
@ApiModel → @Schema
@ApiModelProperty(hidden = true) → @Schema(accessMode = READ_ONLY)
@ApiModelProperty → @Schema
@ApiOperation(value = "foo", notes = "bar") → @Operation(summary = "foo", description = "bar")
@ApiParam → @Parameter
@ApiResponse(code = 404, message = "foo") → @ApiResponse(responseCode = "404", description = "foo")