-
Notifications
You must be signed in to change notification settings - Fork 0
✨️feat: 공통 응답 재수정[#34] #39
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,27 +4,27 @@ | |||||||
|
|
||||||||
| @JsonInclude(JsonInclude.Include.NON_NULL) | ||||||||
| public record ApiResponse<T>( | ||||||||
| String message, | ||||||||
| boolean success, | ||||||||
| T data | ||||||||
| ) { | ||||||||
|
|
||||||||
| public static <T> ApiResponse<T> success(T data) { | ||||||||
| return new ApiResponse<>( "요청이 정상적으로 처리되었습니다.", data); | ||||||||
| return new ApiResponse<>(Boolean.TRUE, data); | ||||||||
| } | ||||||||
|
|
||||||||
| public static <T> ApiResponse<T> success(String message, T data) { | ||||||||
| return new ApiResponse<>(message, data); | ||||||||
| public static <T> ApiResponse<T> success(boolean isSuccess, T data) { | ||||||||
| return new ApiResponse<>(isSuccess, data); | ||||||||
| } | ||||||||
|
|
||||||||
|
Comment on lines
+15
to
18
|
||||||||
| public static <T> ApiResponse<T> success(boolean isSuccess, T data) { | |
| return new ApiResponse<>(isSuccess, data); | |
| } |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); |
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Copilot
AI
Dec 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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); | |
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the primitive literal
trueinstead ofBoolean.TRUE. Since the field is a primitive boolean, using the boxed Boolean constant unnecessarily creates an object that will be immediately unboxed.