refactor: swagger配置移除

This commit is contained in:
CaptainB 2024-03-27 16:55:43 +08:00
parent ca334d7c24
commit 38a16d9799
2 changed files with 0 additions and 131 deletions

View File

@ -1,99 +0,0 @@
package io.metersphere.system.config;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ModuleOpenApiConfig {
private static final String prePackages = "io.metersphere.";
@Bean
public GroupedOpenApi systemApi() {
return GroupedOpenApi.builder()
.group("system-setting")
.packagesToScan(prePackages + "system")
.build();
}
@Bean
public GroupedOpenApi projectApi() {
return GroupedOpenApi.builder()
.group("project-management")
.packagesToScan(prePackages + "project")
.build();
}
@Bean
public GroupedOpenApi apiTestApi() {
return GroupedOpenApi.builder()
.group("api-test")
.packagesToScan(prePackages + "api")
.build();
}
@Bean
public GroupedOpenApi bugApi() {
return GroupedOpenApi.builder()
.group("bug-management")
.packagesToScan(prePackages + "bug")
.build();
}
@Bean
public GroupedOpenApi caseApi() {
return GroupedOpenApi.builder()
.group("case-management")
.packagesToScan(prePackages + "functional")
.build();
}
@Bean
public GroupedOpenApi loadApi() {
return GroupedOpenApi.builder()
.group("load-test")
.packagesToScan(prePackages + "load")
.build();
}
@Bean
public GroupedOpenApi planApi() {
return GroupedOpenApi.builder()
.group("test-plan")
.packagesToScan(prePackages + "plan")
.build();
}
@Bean
public GroupedOpenApi uiApi() {
return GroupedOpenApi.builder()
.group("ui-test")
.packagesToScan(prePackages + "ui")
.build();
}
@Bean
public GroupedOpenApi workstationApi() {
return GroupedOpenApi.builder()
.group("workstation")
.packagesToScan(prePackages + "workstation")
.build();
}
@Bean
public GroupedOpenApi xpackApi() {
return GroupedOpenApi.builder()
.group("xpack")
.packagesToScan(prePackages + "xpack")
.build();
}
@Bean
public GroupedOpenApi sdkApi() {
return GroupedOpenApi.builder()
.group("sdk")
.packagesToScan(prePackages + "sdk")
.build();
}
}

View File

@ -1,32 +0,0 @@
package io.metersphere.system.config;
import io.metersphere.sdk.constants.SessionConstants;
import io.swagger.v3.oas.annotations.OpenAPIDefinition;
import io.swagger.v3.oas.annotations.info.Info;
import io.swagger.v3.oas.annotations.servers.Server;
import io.swagger.v3.oas.models.parameters.Parameter;
import org.springdoc.core.customizers.OperationCustomizer;
import org.springframework.context.annotation.Bean;
@OpenAPIDefinition(
info = @Info(
title = "${spring.application.name}",
version = "3.0"
),
servers = @Server(url = "/")
)
public class OpenApiConfig {
@Bean
public OperationCustomizer customize() {
return (operation, handlerMethod) -> {
if (!"login".equals(handlerMethod.getMethod().getName())) {
return operation
.addParametersItem(new Parameter().in("header").required(true).name(SessionConstants.CSRF_TOKEN))
.addParametersItem(new Parameter().in("header").required(true).name(SessionConstants.HEADER_TOKEN));
}
return operation;
};
}
}