Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feat] 스웨거 설정을 적용해요 #14

Merged
merged 2 commits into from
Jun 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions api/src/main/kotlin/com/mashup/dojo/SampleController.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ package com.mashup.dojo

import com.mashup.dojo.common.DojoApiResponse
import com.mashup.dojo.usecase.SampleUseCase
import io.swagger.v3.oas.annotations.Operation
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.PathVariable
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.bind.annotation.RestController

Expand All @@ -11,8 +15,22 @@ import org.springframework.web.bind.annotation.RestController
class SampleController(
private val sampleUseCase: SampleUseCase,
) {
@GetMapping
fun test(): DojoApiResponse<Long> {
/**
* 스웨거 예시
* http://localhost:8080/swagger-ui/index.html
*/
@GetMapping("/{id}")
@Tag(name = "Sample", description = "Sample입니다.")
@Operation(
summary = "Sample API",
description = "Sample API 입니다요",
responses = [
ApiResponse(responseCode = "200", description = "샘플 API 성공하면 어쩌구 데이터가 내려갑니다.")
]
)
fun test(
@PathVariable id: Long,
): DojoApiResponse<Long> {
return DojoApiResponse.success(sampleUseCase.getSampleId())
}
}
1 change: 1 addition & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ springBoot {
project(":api") {
dependencies {
api(project(":service"))
implementation("org.springdoc:springdoc-openapi-starter-webmvc-ui:2.5.0")
implementation("org.springframework.boot:spring-boot-starter-web")
}
}
Expand Down
Loading