Skip to content
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

[FIX] 매거진 수정 api 변경, @Valid 적용, domain/s3로 폴더링 변경 #151

Merged
merged 7 commits into from
Mar 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/com/gam/api/common/ErrorHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ResponseEntity<ApiResponse> handleIllegalArgumentException(IllegalArgumen

@ExceptionHandler(MethodArgumentNotValidException.class)
public ResponseEntity<ApiResponse> handleMethodArgumentNotValidException(MethodArgumentNotValidException exception){
ApiResponse response = ApiResponse.fail(EMPTY_METHOD_ARGUMENT.getMessage());
ApiResponse response = ApiResponse.fail(exception.getBindingResult().getAllErrors().get(0).getDefaultMessage());
Copy link
Member

Choose a reason for hiding this comment

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

getAllErrors의 0번째말고 다른 인덱스의 값들은 어떤게 들어있나요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

아래와 같습니당!
{ "success": false, "message": "[Field error in object 'userOnboardRequestDTO' on field 'userName': rejected value []; codes [Size.userOnboardRequestDTO.userName,Size.userName,Size.java.lang.String,Size]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [userOnboardRequestDTO.userName,userName]; arguments []; default message [userName],15,1]; default message [userName의 길이는 1글자 이상 15글자 이하여야 합니다.]]", "data": "" }

Copy link
Member

Choose a reason for hiding this comment

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

이게 0번째 인덱스의 값인가요?

return new ResponseEntity<>(response, HttpStatus.BAD_REQUEST);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Size;

public record UserOnboardRequestDTO(
@NotBlank
@NotEmpty
@Size(min= 1, max= 15, message = "userName의 길이는 1글자 이상 15글자 이하여야 합니다.")
String userName,
@NotBlank
@NotEmpty
@NotBlank(message = "info는 \"\"일 수 없습니다.")
Copy link
Member

Choose a reason for hiding this comment

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

오 ""은 뭘까요?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

"" 빈 스트링 들어올 경우에 message를 나타냅니다!

Copy link
Member

Choose a reason for hiding this comment

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

"" 인 이유가 궁금했습니다!

@NotEmpty(message = "info는 null일 수 없습니다.")
String info,
@NotEmpty(message = "tags는 null일 수 없습니다, 하나 이상의 tag를 선택 해 주세요.")
int[] tags
Expand Down