From 12a323c9e7218fbad845886471bb1f8d5c526ac9 Mon Sep 17 00:00:00 2001 From: wjddn2165 Date: Tue, 30 Jul 2024 14:29:06 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20Swagger=20=EC=9D=98=EC=A1=B4=EC=84=B1?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80=20=EB=B0=8F=20config=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Server/build.gradle | 1 + .../global/config/SwaggerConfig.java | 24 +++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 Server/src/main/java/JGS/CasperEvent/global/config/SwaggerConfig.java diff --git a/Server/build.gradle b/Server/build.gradle index abf90c48..cec2906e 100644 --- a/Server/build.gradle +++ b/Server/build.gradle @@ -22,6 +22,7 @@ dependencies { implementation 'org.springframework.boot:spring-boot-starter-web' testImplementation 'org.springframework.boot:spring-boot-starter-test' testRuntimeOnly 'org.junit.platform:junit-platform-launcher' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.2.0' } tasks.named('test') { diff --git a/Server/src/main/java/JGS/CasperEvent/global/config/SwaggerConfig.java b/Server/src/main/java/JGS/CasperEvent/global/config/SwaggerConfig.java new file mode 100644 index 00000000..388701b2 --- /dev/null +++ b/Server/src/main/java/JGS/CasperEvent/global/config/SwaggerConfig.java @@ -0,0 +1,24 @@ +package JGS.CasperEvent.global.config; + +import io.swagger.v3.oas.models.Components; +import io.swagger.v3.oas.models.OpenAPI; +import io.swagger.v3.oas.models.info.Info; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class SwaggerConfig { + @Bean + public OpenAPI openAPI() { + return new OpenAPI() + .components(new Components()) + .info(apiInfo()); + } + + private Info apiInfo() { + return new Info() + .title("API Test") // API의 제목 + .description("Let's practice Swagger UI") // API에 대한 설명 + .version("1.0.0"); // API의 버전 + } +}