🚑 Fix swagger url
This commit is contained in:
parent
0364dabb89
commit
3fa9f8f7a1
@ -1,33 +1,35 @@
|
|||||||
package net.Broken.Api.OpenApi;
|
package net.Broken.Api.OpenApi;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.models.Components;
|
import io.swagger.v3.oas.models.Components;
|
||||||
import io.swagger.v3.oas.models.OpenAPI;
|
import io.swagger.v3.oas.models.OpenAPI;
|
||||||
import io.swagger.v3.oas.models.security.SecurityRequirement;
|
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 io.swagger.v3.oas.models.servers.Server;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class OpenApiConfig {
|
public class OpenApiConfig {
|
||||||
|
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public OpenAPI customOpenAPI() {
|
||||||
|
final String securitySchemeName = "JWT";
|
||||||
|
|
||||||
@Bean
|
// final String apiTitle = String.format("%s API", StringUtils.capitalize(moduleName));
|
||||||
public OpenAPI customOpenAPI() {
|
return new OpenAPI()
|
||||||
final String securitySchemeName = "JWT";
|
.addSecurityItem(new SecurityRequirement().addList(securitySchemeName))
|
||||||
// final String apiTitle = String.format("%s API", StringUtils.capitalize(moduleName));
|
.components(
|
||||||
return new OpenAPI()
|
new Components()
|
||||||
.addSecurityItem(new SecurityRequirement().addList(securitySchemeName))
|
.addSecuritySchemes(securitySchemeName,
|
||||||
.components(
|
new SecurityScheme()
|
||||||
new Components()
|
.name(securitySchemeName)
|
||||||
.addSecuritySchemes(securitySchemeName,
|
.type(SecurityScheme.Type.HTTP)
|
||||||
new SecurityScheme()
|
.scheme("bearer")
|
||||||
.name(securitySchemeName)
|
.bearerFormat("JWT")
|
||||||
.type(SecurityScheme.Type.HTTP)
|
)
|
||||||
.scheme("bearer")
|
|
||||||
.bearerFormat("JWT")
|
|
||||||
)
|
)
|
||||||
);
|
.addServersItem(new Server().url("/").description("Default"));
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user