Skip to content

Commit

Permalink
swagger fix
Browse files Browse the repository at this point in the history
  • Loading branch information
heesane committed Jul 11, 2024
1 parent a0c25c4 commit e11eeff
Showing 1 changed file with 13 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
package hhs.server.home_server.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.security.SecurityRequirement;
import io.swagger.v3.oas.models.security.SecurityScheme;
import io.swagger.v3.oas.models.Components;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SwaggerConfig {

@Bean
public OpenAPI api() {
public OpenAPI customOpenAPI() {
return new OpenAPI()
.components(new Components())
.info(apiInfo());
.addSecurityItem(new SecurityRequirement().addList("bearerAuth"))
.components(new Components()
.addSecuritySchemes("bearerAuth",
new SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT")))
.info(new Info()
.title("Home Server API")
.version("API v1.0")
.description("API documentation"));
}

private Info apiInfo() {
return new Info().
title("Home Server API").
version("API v1.0").
description("API");
}

}

0 comments on commit e11eeff

Please sign in to comment.