Conversation
|
Caution Review failedThe pull request is closed. WalkthroughApiResponse 클래스의 주요 생성자가 String message 기반에서 boolean success 기반으로 변경되었으며, 모든 팩토리 메서드가 이에 맞게 업데이트되었습니다. 새로운 success/error 오버로드가 추가되어 boolean 플래그를 사용한 응답 상태 표시를 지원합니다. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes
Possibly related PRs
Poem
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR refactors the ApiResponse class to change the response structure from {message, data} to {success, data}, replacing the String message field with a boolean success indicator.
Key Changes
- Changed the
ApiResponserecord field fromString messagetoboolean success - Updated all factory methods (
success()anderror()) to use boolean values instead of message strings - Modified method signatures to accommodate the new response format
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| public static <T> ApiResponse<T> success(boolean isSuccess, T data) { | ||
| return new ApiResponse<>(isSuccess, data); | ||
| } | ||
|
|
There was a problem hiding this comment.
The success() method should not accept a boolean isSuccess parameter. A method named "success" should always set success to true. If you need to dynamically control the success value, consider creating a different factory method or using the constructor directly.
| public static <T> ApiResponse<T> success(boolean isSuccess, T data) { | |
| return new ApiResponse<>(isSuccess, data); | |
| } |
| public static <T> ApiResponse<T> success(String message) { | ||
| return new ApiResponse<>(Boolean.TRUE, null); |
There was a problem hiding this comment.
The message parameter is accepted but not used. Since the response format no longer includes a message field (only success and data), this parameter should be removed from the method signature.
| public static <T> ApiResponse<T> error(String message) { | ||
| return new ApiResponse<>(false, null); |
There was a problem hiding this comment.
The message parameter is accepted but not used. Since the response format no longer includes a message field (only success and data), this parameter should be removed from the method signature.
| public static <T> ApiResponse<T> error(boolean isSuccess, T data) { | ||
| return new ApiResponse<>(isSuccess, data); | ||
| } |
There was a problem hiding this comment.
The error() method should not accept a boolean isSuccess parameter. A method named "error" should always set success to false. If you need to dynamically control the success value, consider creating a different factory method or using the constructor directly.
| public static <T> ApiResponse<T> error(boolean isSuccess, T data) { | |
| return new ApiResponse<>(isSuccess, data); | |
| } |
|
|
||
| public static <T> ApiResponse<T> success(T data) { | ||
| return new ApiResponse<>( "요청이 정상적으로 처리되었습니다.", data); | ||
| return new ApiResponse<>(Boolean.TRUE, data); |
There was a problem hiding this comment.
Use the primitive literal true instead of Boolean.TRUE. Since the field is a primitive boolean, using the boxed Boolean constant unnecessarily creates an object that will be immediately unboxed.
| public static <T> ApiResponse<T> success( String message) { | ||
| return new ApiResponse<>( message, null); | ||
| public static <T> ApiResponse<T> success(String message) { | ||
| return new ApiResponse<>(Boolean.TRUE, null); |
There was a problem hiding this comment.
Use the primitive literal true instead of Boolean.TRUE. Since the field is a primitive boolean, using the boxed Boolean constant unnecessarily creates an object that will be immediately unboxed.
| return new ApiResponse<>(Boolean.TRUE, null); | |
| return new ApiResponse<>(true, null); |
📝 Pull Request
📌 PR 종류
해당하는 항목에 체크해주세요.
✨ 변경 내용
success: {boolean}
data: {}
형식으로 수정합니다.
🔍 관련 이슈
🧪 테스트
변경된 기능에 대한 테스트 범위 또는 테스트 결과를 작성해주세요.
🚨 확인해야 할 사항 (Checklist)
PR을 제출하기 전에 아래 항목들을 확인해주세요.
🙋 기타 참고 사항
리뷰어가 참고하면 좋을 만한 추가 설명이 있다면 적어주세요.
Summary by CodeRabbit
릴리스 노트
✏️ Tip: You can customize this high-level summary in your review settings.