-
Notifications
You must be signed in to change notification settings - Fork 8
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
[BE] feat: validation 추가 (#113) #365
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BGuga
force-pushed
the
feat/#113
branch
2 times, most recently
from
August 15, 2023 08:46
25e516e
to
07d7f0c
Compare
# Conflicts: # backend/src/main/java/com/festago/dto/FestivalCreateRequest.java # backend/src/main/java/com/festago/dto/StageCreateRequest.java # backend/src/main/java/com/festago/dto/TicketCreateRequest.java # backend/src/main/java/com/festago/dto/TicketValidationRequest.java # backend/src/main/java/com/festago/dto/TicketingRequest.java
# Conflicts: # backend/src/main/java/com/festago/presentation/AdminController.java # backend/src/main/java/com/festago/presentation/GlobalExceptionHandler.java
BGuga
force-pushed
the
feat/#113
branch
2 times, most recently
from
September 14, 2023 02:29
91d393b
to
bdeee94
Compare
xxeol2
approved these changes
Sep 14, 2023
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.
113번 형님.... 들어가시죠
seokjin8678
approved these changes
Sep 14, 2023
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.
고생하셨습니다!
carsago
approved these changes
Sep 14, 2023
BGuga
added a commit
that referenced
this pull request
Oct 17, 2023
* feat: 어노테이션 기반의 Spring validation 추가 * feat: 도메인 validation 추가 * feat: lineUp 은 null 일 수 있다. * feat: dto validation 추가 * feat: MethodArgumentNotValidException 에 대한 custom 핸들링 * feat: dto 의 예외 메시지 지정한다 * fix: Member 의 profileImage 가 null 인 경우의 null check 제거 * feat: length 검증 전 null check 가 선행되도록 변경 * refactor: Objects.isNull -> == null 확인으로 변경 * feat: Service Entity 생성 로직 삭제 * feat: socialType Enumerated 추가 * feat: @RequestBody validate 추가 * feat: dto @Valid 실패시 400 response
BGuga
added a commit
that referenced
this pull request
Oct 17, 2023
* feat: 어노테이션 기반의 Spring validation 추가 * feat: 도메인 validation 추가 * feat: lineUp 은 null 일 수 있다. * feat: dto validation 추가 * feat: MethodArgumentNotValidException 에 대한 custom 핸들링 * feat: dto 의 예외 메시지 지정한다 * fix: Member 의 profileImage 가 null 인 경우의 null check 제거 * feat: length 검증 전 null check 가 선행되도록 변경 * refactor: Objects.isNull -> == null 확인으로 변경 * feat: Service Entity 생성 로직 삭제 * feat: socialType Enumerated 추가 * feat: @RequestBody validate 추가 * feat: dto @Valid 실패시 400 response
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📌 관련 이슈
✨ PR 세부 내용
Exception Handler 분리 이유 : 기존에 GlobalExceptionHandler 는 ResponseEntityExceptionHandler 를 상속받고 있었습니다.
그래서 GlobaclExcpeionHandler 는 MethodArgumentNotValidException 를 처리하는 handler 로 지정되었는데 MethodArgumentNotValidException 를 커스텀하게 핸들링 하기 위해서는 두 개의 클래스로 분리하여서 GlobalExceptionHandler 가 우선순위를 갖도록 변경하였습니다. MethodArgumentNotValidException 는 에러 메시지가 통일성 있게 반환되도록 만들기 위함입니다.
ManyToOne notNull 제약 조건 추가 :
Stage 는 당연지사 Festival 이 있어야 하는 것이 맞아보여 해당 column 도 not null 제약 조건으로 추가해주었습니다.
EnumType Length 제약 생략 : enum 의 경우 @SiZe 가 validation 을 진행하지 못하는 문제가 식별되어서 해당 @column(length = 30) 로 지정하려 했으나 enum 의 경우 굳이 달아줘야하는지 의문이 들어 생략하도록 했습니다.
@SiZe(255) application 레벨에서 validation 하려는 취지에 맞게 기본값인 Size(255) 도 명시적으로 지정해주었습니다.