Skip to content

Conversation

@NCookies
Copy link
Collaborator

@NCookies NCookies commented Jun 12, 2025

작업 내용

  • 커뮤니티 및 알림 도메인의 controller와 dto에 Swagger 어노테이션 적용

Summary by CodeRabbit

  • 문서화

    • 커뮤니티 관련 API(DTO, 컨트롤러, 응답 객체)에 Swagger/OpenAPI 어노테이션이 추가되어 API 문서가 더욱 상세하고 명확하게 개선되었습니다.
    • 각 필드와 엔드포인트에 설명, 예시, 필수 여부 등이 문서화되어 API 사용성이 향상되었습니다.
    • 알림, 토론, 댓글, 추천(투표) 관련 API 문서도 동일하게 개선되었습니다.
  • 신규 기능

    • 댓글 추천 상태를 조회하는 API 엔드포인트가 추가되었습니다.

@NCookies NCookies self-assigned this Jun 12, 2025
@NCookies NCookies added the documentation Improvements or additions to documentation label Jun 12, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 12, 2025

"""

Walkthrough

이 변경사항은 커뮤니티 토론, 댓글, 투표, 알림 관련 DTO와 컨트롤러에 Swagger/OpenAPI 어노테이션을 추가하여 API 문서화를 강화합니다. 각 DTO 필드와 컨트롤러 메서드에 설명, 예시, 필수 여부 등의 메타데이터가 추가되었으며, 일부 컨트롤러에 소폭의 코드 리팩토링이 포함되어 있습니다.

Changes

파일(들) 변경 요약
.../dto/request/DiscussionCreateRequest.java
.../dto/request/DiscussionModifyRequest.java
.../dto/request/ReplyCreateRequest.java
.../dto/request/ReplyModifyRequest.java
각 DTO record 클래스 및 필드에 Swagger/OpenAPI @Schema 어노테이션 추가, 필드 설명/예시/필수 여부/최대 길이 명시, 일부 메서드 내 필드 접근 방식 수정
.../dto/response/DiscussionResponse.java
.../dto/response/ReplyResponse.java
.../dto/response/VoteResponse.java
각 응답 DTO record 및 필드에 Swagger/OpenAPI @Schema 어노테이션 추가, 기존 record 선언을 어노테이션이 적용된 형태로 변경
.../presentation/community/DiscussionController.java
.../presentation/community/DiscussionVoteController.java
.../presentation/community/ReplyController.java
.../presentation/community/ReplyVoteController.java
각 REST 컨트롤러 및 엔드포인트에 Swagger/OpenAPI 어노테이션(@Tag, @Operation, @Parameter, @ApiResponse) 추가, 일부 메서드 반환부 리팩토링 및 신규 메서드 추가(ReplyVoteController)
.../presentation/notification/NotificationController.java 알림 컨트롤러 및 메서드에 Swagger/OpenAPI 어노테이션 추가, Pageable 파라미터에 @ParameterObject 적용

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant Controller
  participant Service

  Client->>Controller: API 요청 (예: 토론 생성/수정/조회 등)
  Controller->>Service: 서비스 계층 호출
  Service-->>Controller: 처리 결과 반환
  Controller-->>Client: 응답 DTO 반환 (Swagger 문서화된 형태)
Loading

Possibly related PRs

Suggested reviewers

  • chat26666
  • thezz9

Poem

🐰
API 문서화에 꽃이 피었네,
Swagger 어노테이션 줄줄이 달고,
필드마다 설명, 예시도 곁들여,
컨트롤러도 알록달록 꾸며졌지!
토론도, 댓글도, 투표도 반짝—
문서 읽는 개발자, 오늘은 기분 Up!

( ˘▽˘)っ━☆゚.*・.
"""


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c9464e6 and ac9bfd9.

📒 Files selected for processing (3)
  • src/main/java/org/ezcode/codetest/presentation/community/DiscussionController.java (2 hunks)
  • src/main/java/org/ezcode/codetest/presentation/community/ReplyController.java (3 hunks)
  • src/main/java/org/ezcode/codetest/presentation/notification/NotificationController.java (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • src/main/java/org/ezcode/codetest/presentation/notification/NotificationController.java
  • src/main/java/org/ezcode/codetest/presentation/community/ReplyController.java
  • src/main/java/org/ezcode/codetest/presentation/community/DiscussionController.java
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (8)
src/main/java/org/ezcode/codetest/application/community/dto/response/DiscussionResponse.java (1)

21-22: languages 필드 @Schema 설정
언어명 필드에 대한 예시와 필수 여부가 적절합니다.

필드명이 단수형(language)이 더 직관적일 수 있으니 검토해보세요.

src/main/java/org/ezcode/codetest/presentation/community/DiscussionController.java (3)

38-46: createDiscussion 메소드 Swagger @operation@apiresponse
Path 변수와 응답 코드(CREATED/201)가 적절히 문서화되었습니다.

@OperationrequestBody 속성으로 요청 본문 스키마를 명시하면 문서 완결성을 더욱 높일 수 있습니다.


75-84: modifyDiscussion 메소드 Swagger @operation@apiresponse
수정 API의 Path 변수 및 응답 코드(200)가 정확히 문서화되었습니다.

요청 본문에 대한 스키마 설명을 requestBody 속성으로 추가 검토해보세요.


96-104: removeDiscussion 메소드 Swagger @operation@apiresponse
삭제 API의 Path 변수와 응답 코드(200)가 문서화되어 있습니다.

삭제 성공 시 HTTP 204 No Content 사용을 고려하면 더 RESTful한 설계가 될 수 있습니다.

src/main/java/org/ezcode/codetest/application/community/dto/request/DiscussionModifyRequest.java (1)

3-4: 불필요한 와일드카드 static import

import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.*; 구문은 열거형 상수 **하나(REQUIRED)**만 사용하면서 모든 상수를 가져오고 있습니다. 필요 없는 심벌까지 전부 import 하면 IDE 자동완성 목록이 불필요하게 길어지고, 읽는 사람이 실제로 어떤 상수가 쓰였는지 추적하기 어려워집니다.

-import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.*;
+import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
src/main/java/org/ezcode/codetest/presentation/community/ReplyController.java (1)

63-73: Pageable 파라미터가 문서화되지 않음

Pageable 을 받을 때 @ParameterObject 를 선언하지 않아 Swagger 상에서 쿼리 파라미터(page, size, sort)가 노출되지 않습니다. 상위 DiscussionController 와 일관성을 위해 다음처럼 추가해주세요.

-@PageableDefault Pageable pageable
+@ParameterObject @PageableDefault Pageable pageable
src/main/java/org/ezcode/codetest/application/community/dto/request/ReplyCreateRequest.java (1)

3-4: 정적 와일드카드 import 대신 필요한 상수만 명시적으로 import 권장

import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.*; 는 과도하게 범위를 넓혀 불필요한 심벌까지 노출됩니다. 현재 파일에서는 REQUIRED 하나만 사용하므로 아래처럼 명시적으로 가져오면 가독성과 IDE-지원이 개선됩니다.

-import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.*;
+import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
src/main/java/org/ezcode/codetest/application/community/dto/response/ReplyResponse.java (1)

3-4: 와일드카드 static import 최소화

여기서는 REQUIRED, NOT_REQUIRED 두 값만 필요합니다. 불필요한 와일드카드 대신 명시적으로 가져오면 의존 관계가 선명해집니다.

-import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.*;
+import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED;
+import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.NOT_REQUIRED;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7b640de and c9464e6.

📒 Files selected for processing (12)
  • src/main/java/org/ezcode/codetest/application/community/dto/request/DiscussionCreateRequest.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/community/dto/request/DiscussionModifyRequest.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/community/dto/request/ReplyCreateRequest.java (2 hunks)
  • src/main/java/org/ezcode/codetest/application/community/dto/request/ReplyModifyRequest.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/community/dto/response/DiscussionResponse.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/community/dto/response/ReplyResponse.java (1 hunks)
  • src/main/java/org/ezcode/codetest/application/community/dto/response/VoteResponse.java (1 hunks)
  • src/main/java/org/ezcode/codetest/presentation/community/DiscussionController.java (1 hunks)
  • src/main/java/org/ezcode/codetest/presentation/community/DiscussionVoteController.java (1 hunks)
  • src/main/java/org/ezcode/codetest/presentation/community/ReplyController.java (2 hunks)
  • src/main/java/org/ezcode/codetest/presentation/community/ReplyVoteController.java (1 hunks)
  • src/main/java/org/ezcode/codetest/presentation/notification/NotificationController.java (2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
src/main/java/org/ezcode/codetest/presentation/community/ReplyController.java (3)
src/main/java/org/ezcode/codetest/presentation/community/DiscussionVoteController.java (1)
  • RestController (21-70)
src/main/java/org/ezcode/codetest/presentation/community/ReplyVoteController.java (1)
  • RestController (21-75)
src/main/java/org/ezcode/codetest/presentation/community/DiscussionController.java (1)
  • RestController (30-115)
🔇 Additional comments (26)
src/main/java/org/ezcode/codetest/application/community/dto/request/DiscussionCreateRequest.java (4)

3-3: Swagger import 추가 확인
static import(RequiredMode.*)와 @Schema 어노테이션용 import가 올바르게 추가되었습니다.

Also applies to: 10-10


15-15: 클래스 레벨 @Schema 적용 검토
DiscussionCreateRequest에 이름과 설명이 적절히 정의되어 있습니다.


18-20: languageId 필드 Swagger @Schema 설정
필드 설명, 예시, requiredMode = REQUIRED가 DTO 검증 요구사항과 일치합니다.


22-25: content 필드 Swagger @Schema 설정
maxLengthrequiredMode가 검증 제약조건과 동일하며 예시도 적절합니다.

src/main/java/org/ezcode/codetest/application/community/dto/request/ReplyModifyRequest.java (3)

3-3: Swagger import 추가 확인
RequiredMode.* static import 및 @Schema import가 올바르게 추가되었습니다.

Also applies to: 5-5


9-9: ReplyModifyRequest 클래스 @Schema 적용
레코드 이름과 설명이 적절히 정의되어 API 문서화가 강화되었습니다.


12-15: content 필드 Swagger @Schema 설정
설명, 예시, maxLength, requiredMode = REQUIRED가 검증 제약조건과 일치합니다.

src/main/java/org/ezcode/codetest/application/community/dto/response/DiscussionResponse.java (6)

3-3: Swagger import 및 static import 확인
RequiredMode.*@Schema import가 정확히 추가되어 있습니다.

Also applies to: 8-8


10-10: DiscussionResponse 클래스 @Schema 적용
응답 DTO 이름과 설명이 명확하게 정의되었습니다.


12-13: discussionId 필드 @Schema 설정
ID 필드에 대한 예시와 requiredMode = REQUIRED 지정이 적절합니다.


15-16: userInfo 필드 @Schema 설정
작성자 정보 필드가 requiredMode = REQUIRED로 잘 문서화되었습니다.


18-19: problemId 필드 @Schema 설정
문제 ID 필드 설명 및 예시가 올바르게 설정되었습니다.


24-25: content 필드 @Schema 설정
토론 내용 필드 설명과 예시가 일관성 있게 적용되었습니다.

src/main/java/org/ezcode/codetest/application/community/dto/response/VoteResponse.java (3)

3-3: Swagger import 추가 확인
RequiredMode.* static import와 @Schema import가 정확히 포함되었습니다.

Also applies to: 5-5


7-8: VoteResponse 클래스 @Schema 적용
레코드 이름과 설명이 명확하게 정의되어 있습니다.


9-14: voteStatus 필드 @Schema 설정
필드 설명, 예시("true"), requiredMode = REQUIRED가 잘 적용되었습니다.

src/main/java/org/ezcode/codetest/presentation/community/DiscussionController.java (3)

23-26: Swagger import 추가 확인
@Operation, @Parameter, @ApiResponse, @Tag import가 올바르게 추가되었습니다.


32-32: 컨트롤러 클래스 @tag 적용
API 그룹명을 Discussions로 정의하여 문서화 일관성이 유지되었습니다.


57-65: getDiscussions 메소드 Swagger @operation@apiresponse
페이징 조회 API의 요약, 설명, Path 변수, 응답 코드(200)가 잘 정의되었습니다.

src/main/java/org/ezcode/codetest/application/community/dto/request/DiscussionModifyRequest.java (1)

10-20: Swagger 메타데이터 👍

필드·클래스 수준의 @Schema 메타데이터가 검증 애노테이션과 잘 결합되어 있습니다. API 문서 가독성이 크게 향상될 것으로 보이며, 별다른 문제점은 없습니다.

src/main/java/org/ezcode/codetest/presentation/community/ReplyVoteController.java (1)

29-40: Swagger 주석 추가 확인 완료

@Operation, @ApiResponse 가 명확히 작성되어 있어 API 문서 품질이 향상되었습니다. 별다른 이슈 없이 적용 가능합니다.

src/main/java/org/ezcode/codetest/presentation/community/DiscussionVoteController.java (1)

29-40: Swagger 주석 추가 확인 완료

토론 추천 토글/조회 엔드포인트에 대한 문서화가 잘 반영되었습니다. 구현·주석 모두 문제없습니다.

src/main/java/org/ezcode/codetest/application/community/dto/request/ReplyCreateRequest.java (2)

13-23: Swagger 메타데이터 추가 👍

필드별 설명·예시·제한 길이·필수 여부가 명확히 기재되어 API 문서 품질이 크게 향상되었습니다. Bean Validation과도 일관되게 연결되어 있어 문제없습니다.


32-37: 레코드 접근자 사용 수정 확인 완료

request.content() 로 수정하여 레코드 필드를 올바르게 참조합니다. NPE 가능성도 없고, 빌더 체인도 간결합니다.

src/main/java/org/ezcode/codetest/application/community/dto/response/ReplyResponse.java (2)

10-26: 응답 DTO에 대한 상세 스키마 정의 추가 👍

각 필드의 역할과 예시가 명쾌하게 기술되어 Swagger UI에서 이해도를 높여줍니다. nullable=truerequiredMode 조합도 올바르게 사용되었습니다.


28-38: 엔티티 매핑 로직 재확인 요청

reply.getDiscussion() 이 null 이 되는 경우는 도메인 규칙상 없겠지만, JPA 지연 로딩으로 N+1 문제가 발생할 수 있습니다. 컨트롤러·서비스 계층에서 fetch 전략이 적절한지 한 번 더 확인 부탁드립니다.

@NCookies NCookies merged commit 6fed733 into dev Jun 12, 2025
1 check passed
@NCookies NCookies deleted the docs/comm-noti-swagger branch June 12, 2025 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants