🔧 Swagger Config 추가

This commit is contained in:
jini
2022-11-30 16:50:31 +09:00
parent cf80cbd7e9
commit fc2e75af6b
2 changed files with 41 additions and 3 deletions

View File

@@ -0,0 +1,41 @@
package me.jiniworld.demohx.config
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.servers.Server
import org.springframework.beans.factory.annotation.Value
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
@Configuration
class SwaggerConfig(
@Value("\${demo-app.version}") val version: String,
@Value("\${spring.profiles.active}") val profile: String,
@Value("\${demo-app.url}") val url: String,
) {
@Bean
fun openAPI(): OpenAPI =
OpenAPI()
// .components(
// Components()
// .addSecuritySchemes("access_token",
// SecurityScheme().type(SecurityScheme.Type.HTTP).scheme("bearer").bearerFormat("JWT")
// .`in`(SecurityScheme.In.HEADER).name("Authorization")))
// .addSecurityItem(SecurityRequirement().addList("access_token"))
.info(
Info().title("demo-app API - $profile")
.description("Hexagonal Architecture 구조로 만든 코프링 웹 애플리케이션")
.contact(Contact().name("jini").url("https://blog.jiniworld.me/").email("jini@jiniworld.me"))
.license(License().name("MIT License").url("https://github.com/jiniya22/demo-hexagonal/blob/master/LICENSE")))
.servers(
listOf(
Server().url(url).description(
"demo-app api ($profile)"
)
)
)
}

View File

@@ -5,11 +5,8 @@ import io.swagger.v3.oas.annotations.tags.Tag
import me.jiniworld.demohx.annotation.WebAdapter
import me.jiniworld.demohx.application.notice.port.input.GetNoticeQuery
import me.jiniworld.demohx.application.notice.port.input.GetNoticesCommand
import me.jiniworld.demohx.model.BaseResponse
import me.jiniworld.demohx.model.DataResponse
import me.jiniworld.demohx.model.NotFoundException
import me.jiniworld.demohx.model.ServerException
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.*
@WebAdapter