From 79686b88da94784dc97fe3feae241b9f26b01c62 Mon Sep 17 00:00:00 2001 From: yeonjy Date: Sun, 30 Jun 2024 18:51:09 +0900 Subject: [PATCH] refactor: swagger tags -> @Tag --- .../domain/bookmark/api/BookmarkApi.java | 14 ++++----- .../backend/domain/debate/api/DebateApi.java | 31 +++++++------------ .../backend/domain/member/api/MemberApi.java | 5 +-- .../backend/domain/news/api/NewsApi.java | 8 ++--- .../domain/readNews/api/ReadNewsApi.java | 5 +-- .../domain/statistics/api/StatisticsApi.java | 8 ++--- .../backend/global/oauth2/api/AuthApi.java | 8 ++--- 7 files changed, 35 insertions(+), 44 deletions(-) diff --git a/backend/core/src/main/java/com/rollthedice/backend/domain/bookmark/api/BookmarkApi.java b/backend/core/src/main/java/com/rollthedice/backend/domain/bookmark/api/BookmarkApi.java index 7eff090..3b0e976 100644 --- a/backend/core/src/main/java/com/rollthedice/backend/domain/bookmark/api/BookmarkApi.java +++ b/backend/core/src/main/java/com/rollthedice/backend/domain/bookmark/api/BookmarkApi.java @@ -8,16 +8,17 @@ import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.data.domain.Pageable; import java.util.List; +@Tag(name = "Bookmark") public interface BookmarkApi { @Operation( summary = "북마크 전체 조회", description = "회원이 북마크한 뉴스를 페이지로 나누어 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"북마크"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "200", @@ -30,8 +31,7 @@ SuccessResponse> getAllBookmarkedNews( @Operation( summary = "뉴스 북마크 여부 조회", description = "로그인한 회원이 해당 뉴스를 북마크 했는지 여부를 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"북마크"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "200", @@ -46,8 +46,7 @@ SuccessResponse getIsBookmarked( @Operation( summary = "북마크 저장", description = "뉴스에 대하여 북마크로 저장합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"북마크"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "201", @@ -61,8 +60,7 @@ SuccessResponse saveBookmark( @Operation( summary = "북마크 삭제", description = "저장된 북마크를 해제합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"북마크"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "204", diff --git a/backend/core/src/main/java/com/rollthedice/backend/domain/debate/api/DebateApi.java b/backend/core/src/main/java/com/rollthedice/backend/domain/debate/api/DebateApi.java index f109328..8c808f4 100644 --- a/backend/core/src/main/java/com/rollthedice/backend/domain/debate/api/DebateApi.java +++ b/backend/core/src/main/java/com/rollthedice/backend/domain/debate/api/DebateApi.java @@ -13,19 +13,19 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.data.domain.Pageable; import org.springframework.web.bind.annotation.RequestBody; import java.util.List; - +@Tag(name = "Debate") public interface DebateApi { @Operation( summary = "토론방 생성", description = "주제가 선택된 토론방을 생성합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"토론방"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "201", @@ -36,8 +36,7 @@ public interface DebateApi { @Operation( summary = "토론방 전체 조회", description = "회원의 토론방을 페이지로 나누어 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"토론방"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "200", @@ -48,8 +47,7 @@ public interface DebateApi { @Operation( summary = "토론방 삭제", description = "토론방을 삭제합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"토론방"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "204", @@ -62,8 +60,7 @@ SuccessResponse deleteDebateRoom(@Parameter(in = ParameterIn.PATH, descr @Operation( summary = "[인간] 토론 메세지 저장", description = "사용자가 보낸 토론 메세지를 저장합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"토론 메세지"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "201", @@ -79,8 +76,7 @@ SuccessResponse saveHumanDebateMessage( @Operation( summary = "[AI] 토론 메세지 저장", description = "ChatGPT OPENAI가 보낸 토론 메세지를 저장합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"토론 메세지"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "201", @@ -96,8 +92,7 @@ SuccessResponse saveAIDebateMessage( @Operation( summary = "토론 종료", description = "토론을 종료합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"토론방"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponses(value = { @ApiResponse( @@ -117,8 +112,7 @@ SuccessResponse finishDebate( @Operation( summary = "토론 메세지 조회", description = "토론방의 토론 메세지 이력을 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"토론 메세지"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "200", @@ -132,8 +126,7 @@ SuccessResponse> getDebateMessages( @Operation( summary = "토론 요약", description = "토론방의 토론 메세지들을 요약합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"토론방"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponses(value = { @ApiResponse( @@ -153,8 +146,7 @@ SuccessResponse summarizeDebate( @Operation( summary = "토론 요약 조회", description = "토론 요약 내용을 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"토론방"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponses(value = { @ApiResponse( @@ -170,5 +162,4 @@ SuccessResponse getSummarizedDebate( @Parameter(in = ParameterIn.PATH, description = "토론방 ID", required = true) Long roomId ); - } diff --git a/backend/core/src/main/java/com/rollthedice/backend/domain/member/api/MemberApi.java b/backend/core/src/main/java/com/rollthedice/backend/domain/member/api/MemberApi.java index fcb8ad1..3ebcc3e 100644 --- a/backend/core/src/main/java/com/rollthedice/backend/domain/member/api/MemberApi.java +++ b/backend/core/src/main/java/com/rollthedice/backend/domain/member/api/MemberApi.java @@ -5,13 +5,14 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; +@Tag(name = "Member") public interface MemberApi { @Operation( summary = "회원 정보 조회", description = "회원 정보를 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"member"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "200", diff --git a/backend/core/src/main/java/com/rollthedice/backend/domain/news/api/NewsApi.java b/backend/core/src/main/java/com/rollthedice/backend/domain/news/api/NewsApi.java index 78b8356..ccc2d8c 100644 --- a/backend/core/src/main/java/com/rollthedice/backend/domain/news/api/NewsApi.java +++ b/backend/core/src/main/java/com/rollthedice/backend/domain/news/api/NewsApi.java @@ -10,16 +10,17 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.responses.ApiResponses; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.data.domain.Pageable; import java.util.List; +@Tag(name = "Tag") public interface NewsApi { @Operation( summary = "요약 뉴스 전체 조회", description = "요약 뉴스를 페이지로 나누어 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"news"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "200", @@ -30,8 +31,7 @@ public interface NewsApi { @Operation( summary = "요약 뉴스 상세 조회", description = "하나의 요약 뉴스를 상세 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"news"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponses(value = { @ApiResponse( diff --git a/backend/core/src/main/java/com/rollthedice/backend/domain/readNews/api/ReadNewsApi.java b/backend/core/src/main/java/com/rollthedice/backend/domain/readNews/api/ReadNewsApi.java index d52f706..6279d7e 100644 --- a/backend/core/src/main/java/com/rollthedice/backend/domain/readNews/api/ReadNewsApi.java +++ b/backend/core/src/main/java/com/rollthedice/backend/domain/readNews/api/ReadNewsApi.java @@ -5,15 +5,16 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import java.util.List; +@Tag(name = "Read News") public interface ReadNewsApi { @Operation( summary = "최근 읽은 뉴스 조회", description = "가장 최근에 읽은 3개의 뉴스를 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"news"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "200", diff --git a/backend/core/src/main/java/com/rollthedice/backend/domain/statistics/api/StatisticsApi.java b/backend/core/src/main/java/com/rollthedice/backend/domain/statistics/api/StatisticsApi.java index 80066dd..be7e86e 100644 --- a/backend/core/src/main/java/com/rollthedice/backend/domain/statistics/api/StatisticsApi.java +++ b/backend/core/src/main/java/com/rollthedice/backend/domain/statistics/api/StatisticsApi.java @@ -6,15 +6,16 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import java.util.List; +@Tag(name = "Statistics") public interface StatisticsApi { @Operation( summary = "최근 일주일 날짜별 뉴스 조회수 조회", description = "최근 일주일간 날짜별로 뉴스 조회수를 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"통계"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "200", @@ -25,8 +26,7 @@ public interface StatisticsApi { @Operation( summary = "카테고리별 조회수 조회", description = "카테고리별 조회수를 조회합니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"통계"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "200", diff --git a/backend/core/src/main/java/com/rollthedice/backend/global/oauth2/api/AuthApi.java b/backend/core/src/main/java/com/rollthedice/backend/global/oauth2/api/AuthApi.java index 042de62..c9cabee 100644 --- a/backend/core/src/main/java/com/rollthedice/backend/global/oauth2/api/AuthApi.java +++ b/backend/core/src/main/java/com/rollthedice/backend/global/oauth2/api/AuthApi.java @@ -6,17 +6,18 @@ import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.security.SecurityRequirement; +import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.servlet.http.HttpServletResponse; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.RequestBody; +@Tag(name = "Auth") public interface AuthApi { @Operation( summary = "소셜 로그인", description = "소셜 로그인을 합니다. 회원가입이 되어있지 않은 회원일 경우, 회원가입이 진행됩니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"인증"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "200", @@ -30,8 +31,7 @@ SuccessResponse login( @Operation( summary = "닉네임 입력", description = "닉네임을 입력합니다. 해당 로직이 진행되어야 회원가입이 완료됩니다.", - security = {@SecurityRequirement(name = "access_token")}, - tags = {"인증"} + security = {@SecurityRequirement(name = "access_token")} ) @ApiResponse( responseCode = "201",