-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
12 deletions.
There are no files selected for viewing
25 changes: 13 additions & 12 deletions
25
back/home_server/src/main/java/hhs/server/home_server/config/SwaggerConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} | ||
|
||
} |