-
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.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
915e628
commit ac08b45
Showing
1 changed file
with
23 additions
and
6 deletions.
There are no files selected for viewing
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,19 +1,36 @@ | ||
package com.beat.global.swagger; | ||
|
||
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.servers.Server; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class SwaggerConfig { | ||
|
||
@Bean | ||
public OpenAPI openAPI() { | ||
return new OpenAPI() | ||
.info(new Info() | ||
.title("BEAT Project API") | ||
.description("드랍더비트") | ||
.version("1.0.0")); | ||
String jwt = "JWT"; | ||
SecurityRequirement securityRequirement = new SecurityRequirement().addList(jwt); | ||
Components components = new Components().addSecuritySchemes(jwt, new SecurityScheme() | ||
.name(jwt) | ||
.type(SecurityScheme.Type.HTTP) | ||
.scheme("bearer") | ||
.bearerFormat("JWT") | ||
); | ||
return new OpenAPI().addServersItem(new Server().url("/")) | ||
.components(new Components()) | ||
.info(apiInfo()) | ||
.addSecurityItem(securityRequirement) | ||
.components(components); | ||
} | ||
private Info apiInfo() { | ||
return new Info() | ||
.title("BEAT Project API") | ||
.description("간편하게 소규모 공연을 등록하고 관리할 수 있는 티켓 예매 플랫폼") | ||
.version("1.0.0"); | ||
} | ||
} |