|
|
@ -44,18 +44,18 @@ public class SpringDocConfig {
|
|
|
|
|
|
|
|
|
|
|
|
@Bean
|
|
|
|
@Bean
|
|
|
|
@ConditionalOnMissingBean(OpenAPI.class)
|
|
|
|
@ConditionalOnMissingBean(OpenAPI.class)
|
|
|
|
public OpenAPI openApi(SpringDocProperties swaggerProperties) {
|
|
|
|
public OpenAPI openApi(SpringDocProperties properties) {
|
|
|
|
OpenAPI openApi = new OpenAPI();
|
|
|
|
OpenAPI openApi = new OpenAPI();
|
|
|
|
// 文档基本信息
|
|
|
|
// 文档基本信息
|
|
|
|
SpringDocProperties.InfoProperties infoProperties = swaggerProperties.getInfo();
|
|
|
|
SpringDocProperties.InfoProperties infoProperties = properties.getInfo();
|
|
|
|
Info info = convertInfo(infoProperties);
|
|
|
|
Info info = convertInfo(infoProperties);
|
|
|
|
openApi.info(info);
|
|
|
|
openApi.info(info);
|
|
|
|
// 扩展文档信息
|
|
|
|
// 扩展文档信息
|
|
|
|
openApi.externalDocs(swaggerProperties.getExternalDocs());
|
|
|
|
openApi.externalDocs(properties.getExternalDocs());
|
|
|
|
openApi.tags(swaggerProperties.getTags());
|
|
|
|
openApi.tags(properties.getTags());
|
|
|
|
openApi.paths(swaggerProperties.getPaths());
|
|
|
|
openApi.paths(properties.getPaths());
|
|
|
|
openApi.components(swaggerProperties.getComponents());
|
|
|
|
openApi.components(properties.getComponents());
|
|
|
|
Set<String> keySet = swaggerProperties.getComponents().getSecuritySchemes().keySet();
|
|
|
|
Set<String> keySet = properties.getComponents().getSecuritySchemes().keySet();
|
|
|
|
List<SecurityRequirement> list = new ArrayList<>();
|
|
|
|
List<SecurityRequirement> list = new ArrayList<>();
|
|
|
|
SecurityRequirement securityRequirement = new SecurityRequirement();
|
|
|
|
SecurityRequirement securityRequirement = new SecurityRequirement();
|
|
|
|
keySet.forEach(securityRequirement::addList);
|
|
|
|
keySet.forEach(securityRequirement::addList);
|
|
|
|