diff --git a/doorip-api/build.gradle b/doorip-api/build.gradle index 048c55c..73b4460 100644 --- a/doorip-api/build.gradle +++ b/doorip-api/build.gradle @@ -8,8 +8,9 @@ dependencies { implementation group: 'io.jsonwebtoken', name: 'jjwt-jackson', version: '0.11.5' runtimeOnly 'com.h2database:h2' runtimeOnly 'com.mysql:mysql-connector-j' - implementation "org.flywaydb:flyway-core" - implementation "org.flywaydb:flyway-mysql" + implementation 'org.flywaydb:flyway-core' + implementation 'org.flywaydb:flyway-mysql' + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.2' implementation project(path: ':doorip-domain') implementation project(path: ':doorip-external') implementation project(path: ':doorip-common') diff --git a/doorip-api/src/main/java/org/doorip/auth/config/SecurityConfig.java b/doorip-api/src/main/java/org/doorip/auth/config/SecurityConfig.java index e221629..0136f97 100644 --- a/doorip-api/src/main/java/org/doorip/auth/config/SecurityConfig.java +++ b/doorip-api/src/main/java/org/doorip/auth/config/SecurityConfig.java @@ -23,8 +23,8 @@ public class SecurityConfig { private final JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint; private final JwtValidator jwtValidator; private final JwtProvider jwtProvider; - - private static final String[] whiteList = {"/api/users/signin", "/api/users/signup", "/api/users/reissue", "/"}; + private static final String[] whiteList = {"/api/users/signin", "/api/users/signup", "/api/users/reissue", + "/", "/swagger-ui/**", "/error", "/v3/api-docs/**"}; @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { diff --git a/doorip-api/src/main/java/org/doorip/common/HealthCheckApiController.java b/doorip-api/src/main/java/org/doorip/common/HealthCheckApiController.java index a15c8bc..caf7914 100644 --- a/doorip-api/src/main/java/org/doorip/common/HealthCheckApiController.java +++ b/doorip-api/src/main/java/org/doorip/common/HealthCheckApiController.java @@ -1,12 +1,24 @@ package org.doorip.common; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.media.Content; +import io.swagger.v3.oas.annotations.media.Schema; +import io.swagger.v3.oas.annotations.responses.ApiResponse; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; +@Tag(name = "health check", description = "health check API") @RequestMapping("/") @RestController public class HealthCheckApiController { + @Operation(summary = "health check API", description = "health check API 입니다.") + @ApiResponse( + responseCode = "200", + description = "요청이 성공했습니다.", + content = @Content(schema = @Schema(implementation = String.class)) + ) @GetMapping public String healthCheck() { return "doorip spring boot server ok!"; diff --git a/doorip-api/src/main/java/org/doorip/config/SwaggerConfig.java b/doorip-api/src/main/java/org/doorip/config/SwaggerConfig.java new file mode 100644 index 0000000..097f0e3 --- /dev/null +++ b/doorip-api/src/main/java/org/doorip/config/SwaggerConfig.java @@ -0,0 +1,21 @@ +package org.doorip.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 api() { + Info info = new Info() + .title("Doorip API Docs") + .version("v1.0") + .description("Doorip 서비스 API 명세서 입니다."); + return new OpenAPI() + .components(new Components()) + .info(info); + } +}