Skip to content

Commit

Permalink
docs: add swagger description
Browse files Browse the repository at this point in the history
  • Loading branch information
CChuYong committed Jun 16, 2024
1 parent 9e658ec commit 45ff071
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package kr.mafoo.photo.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
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("๋งˆํ‘ธ ๋ฐฑ์—”๋“œ API ๋ช…์„ธ - ์‚ฌ์ง„/์•จ๋ฒ” ์„œ๋น„์Šค")
.version("v1")
.description("์‚ฌ์ง„/์•จ๋ฒ” ๊ด€๋ จ API ๋ช…์„ธ ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค.")
.contact(new Contact()
.name("๊นƒํ—ˆ๋ธŒ ์ฃผ์†Œ")
.url("https://github.com/YAPP-Github/mafoo-backend"))
.license(new License()
.name("MIT License")
.url("https://opensource.org/licenses/MIT"))
)
.addServersItem(new Server()
.url("https://gateway.mafoo.kr/photo/")
.description("ํ”„๋กœ๋•์…˜ ์„œ๋ฒ„ ์‚ฌ์ง„/์•จ๋ฒ” ์„œ๋น„์Šค URL")
)
.addSecurityItem(new SecurityRequirement().addList("Authorization"))
.components(
new Components()
.addSecuritySchemes("Authorization",
new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("Bearer")
.bearerFormat("JWT"))
);
}
}
44 changes: 44 additions & 0 deletions user-service/src/main/java/kr/mafoo/user/config/SwaggerConfig.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package kr.mafoo.user.config;

import io.swagger.v3.oas.models.Components;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.info.License;
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("๋งˆํ‘ธ ๋ฐฑ์—”๋“œ API ๋ช…์„ธ - ์œ ์ € ์„œ๋น„์Šค")
.version("v1")
.description("์‚ฌ์šฉ์ž ์ •๋ณด ๊ด€๋ จ API ๋ช…์„ธ ๋ชฉ๋ก์ž…๋‹ˆ๋‹ค.")
.contact(new Contact()
.name("๊นƒํ—ˆ๋ธŒ ์ฃผ์†Œ")
.url("https://github.com/YAPP-Github/mafoo-backend"))
.license(new License()
.name("MIT License")
.url("https://opensource.org/licenses/MIT"))
)
.addServersItem(new Server()
.url("https://gateway.mafoo.kr/user/")
.description("ํ”„๋กœ๋•์…˜ ์„œ๋ฒ„ ์œ ์ € ์„œ๋น„์Šค URL")
)
.addSecurityItem(new SecurityRequirement().addList("Authorization"))
.components(
new Components()
.addSecuritySchemes("Authorization",
new SecurityScheme()
.type(SecurityScheme.Type.HTTP)
.scheme("Bearer")
.bearerFormat("JWT"))
);
}
}

0 comments on commit 45ff071

Please sign in to comment.