From 0682fc3308b21357fedde5cd5e000eb600d29ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=A4=80=EC=8D=A8=ED=81=AC?= Date: Sat, 6 Jan 2024 19:08:58 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20swagger=20test=EB=A5=BC=20=EC=9C=84?= =?UTF-8?q?=ED=95=9C=20api=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 - .../test/controller/TestController.java | 26 ++++++++++++++++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 79148f5e..b3db3e25 100644 --- a/.gitignore +++ b/.gitignore @@ -36,5 +36,4 @@ out/ ### VS Code ### .vscode/ -.env application.yml diff --git a/src/main/java/com/umc/networkingService/domain/test/controller/TestController.java b/src/main/java/com/umc/networkingService/domain/test/controller/TestController.java index 82baffce..3d31e869 100644 --- a/src/main/java/com/umc/networkingService/domain/test/controller/TestController.java +++ b/src/main/java/com/umc/networkingService/domain/test/controller/TestController.java @@ -1,17 +1,35 @@ package com.umc.networkingService.domain.test.controller; +import io.swagger.v3.oas.annotations.Hidden; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import lombok.RequiredArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +@Tag(name = "예제 API", description = "Swagger 테스트용 API") @RestController @RequiredArgsConstructor @RequestMapping("/test") public class TestController { + @Operation(summary = "문자열 반복", description = "파라미터로 받은 문자열을 2번 반복합니다.") + @Parameter(name = "str", description = "2번 반복할 문자열") + @GetMapping("/returnStr") + public String returnStr(@RequestParam String str) { + return str + "\n" + str; + } + + @GetMapping("/example") + public String example() { + return "예시 API"; + } - @GetMapping - public String getTest() { - return "kimjunseok"; + @Hidden + @GetMapping("/ignore") + public String ignore() { + return "무시되는 API"; } -} +} \ No newline at end of file