mirror of https://github.com/jeecgboot/jeecg-boot
TODO 暂时注释掉,for:【issues/8638】springboot3分支,knife4j不能正确显示文档,但是swagger-ui和v3/api-docs正常 #8638
parent
f0a5edaa49
commit
ae6069882f
|
@ -10,7 +10,6 @@ import io.swagger.v3.oas.models.security.SecurityRequirement;
|
||||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.springdoc.core.customizers.GlobalOpenApiCustomizer;
|
|
||||||
import org.springdoc.core.filters.GlobalOpenApiMethodFilter;
|
import org.springdoc.core.filters.GlobalOpenApiMethodFilter;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
@ -60,30 +59,29 @@ public class Swagger3Config implements WebMvcConfigurer {
|
||||||
return method -> method.isAnnotationPresent(Operation.class);
|
return method -> method.isAnnotationPresent(Operation.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
//TODO 暂时注释掉,for:【issues/8638】springboot3分支,knife4j不能正确显示文档,但是swagger-ui和v3/api-docs正常 #8638
|
||||||
public GlobalOpenApiCustomizer globalOpenApiCustomizer() {
|
// @Bean
|
||||||
return openApi -> {
|
// public GlobalOpenApiCustomizer globalOpenApiCustomizer() {
|
||||||
// 全局添加鉴权参数
|
// return openApi -> {
|
||||||
if (openApi.getPaths() != null) {
|
// // 全局添加鉴权参数
|
||||||
openApi.getPaths().forEach((path, pathItem) -> {
|
// if (openApi.getPaths() != null) {
|
||||||
//log.debug("path: {}", path);
|
// openApi.getPaths().forEach((path, pathItem) -> {
|
||||||
// 检查当前路径是否在排除列表中
|
// //log.debug("path: {}", path);
|
||||||
boolean isExcluded = excludedPaths.stream().anyMatch(excludedPath ->
|
// // 检查当前路径是否在排除列表中
|
||||||
excludedPath.equals(path) ||
|
// boolean isExcluded = excludedPaths.stream().anyMatch(
|
||||||
(excludedPath.endsWith("**") && path.startsWith(excludedPath.substring(0, excludedPath.length() - 2)))
|
// excludedPath -> excludedPath.equals(path) || (excludedPath.endsWith("**") && path.startsWith(excludedPath.substring(0, excludedPath.length() - 2)))
|
||||||
);
|
// );
|
||||||
|
//
|
||||||
if (!isExcluded) {
|
// if (!isExcluded) {
|
||||||
// 接口添加鉴权参数
|
// // 接口添加鉴权参数
|
||||||
pathItem.readOperations()
|
// pathItem.readOperations().forEach(operation ->
|
||||||
.forEach(operation ->
|
// operation.addSecurityItem(new SecurityRequirement().addList(CommonConstant.X_ACCESS_TOKEN))
|
||||||
operation.addSecurityItem(new SecurityRequirement().addList(CommonConstant.X_ACCESS_TOKEN))
|
// );
|
||||||
);
|
// }
|
||||||
}
|
// });
|
||||||
});
|
// }
|
||||||
}
|
// };
|
||||||
};
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public OpenAPI customOpenAPI() {
|
public OpenAPI customOpenAPI() {
|
||||||
|
|
Loading…
Reference in New Issue