diff --git a/build.gradle b/build.gradle index 4a2659d..e650ee1 100644 --- a/build.gradle +++ b/build.gradle @@ -48,6 +48,9 @@ dependencies { // Validation implementation 'org.springframework.boot:spring-boot-starter-validation' + + //Swagger + implementation 'org.springdoc:springdoc-openapi-starter-webmvc-ui:2.0.4' } tasks.named('test') { diff --git a/src/main/java/nutshell/server/constant/AuthConstant.java b/src/main/java/nutshell/server/constant/AuthConstant.java index 87fb993..0f6b131 100644 --- a/src/main/java/nutshell/server/constant/AuthConstant.java +++ b/src/main/java/nutshell/server/constant/AuthConstant.java @@ -7,7 +7,10 @@ public class AuthConstant { public static final String ANONYMOUS_USER = "anonymousUser"; public static final String[] AUTH_WHITELIST = { "/actuator/health", - "/api/**" + "/api/**", + "/v3/api-docs/**", + "/swagger-ui/**", + "/swagger-ui.html" }; private AuthConstant() { } diff --git a/src/main/java/nutshell/server/swagger/SwaggerConfig.java b/src/main/java/nutshell/server/swagger/SwaggerConfig.java new file mode 100644 index 0000000..b7978ed --- /dev/null +++ b/src/main/java/nutshell/server/swagger/SwaggerConfig.java @@ -0,0 +1,25 @@ +package nutshell.server.swagger; + +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() { + Info info = new Info() + .title("Nutshell API") + .description("Nutshell Swagger dev API") + .version("v1"); + + return new OpenAPI() + .components(new Components()) + .info(info); + } +} +