-
Notifications
You must be signed in to change notification settings - Fork 0
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
[BLOOM-041] validation 추가, api 마이너 수정 #46 #48
Conversation
Dompoo
commented
Aug 14, 2024
•
edited
Loading
edited
- spring validation을 추가하였습니다.
- validation 실패시 발생하는 예외에 대하여 전역 예외처리를 추가하였습니다.
- validation이 실제 잘 동작하는지 확인하기 위한 테스트를 작성하였습니다.
- api가 명세서와 다른 부분이 몇개 발견되어, 수정하였습니다.
- 도메인 엔티티 생성/연관관계 매핑 코드를 requestDto가 아니라, 도메인 엔티티 자체에서 수행하도록 리팩토링했습니다.
- validation
- 이제 요청으로 들어오는 request를 검증할 수 있게 되었습니다.
- api
- 식물 저장 api의 요청에서 scientificName 대신에 plantId를 받습니다.
- 식물 전체 조회 api의 응답에서 이제 각 식물의 대표 이미지를 볼 수 있습니다.
- 식물 전체 조회 api의 경우 계층끼리 잘 작동하는지 확인하기 위해 따로 통합테스트를 진행하였습니다.
- 수정된 api들도 swagger 문서화 적용하였습니다.
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.
일단 고생하셨습니다! NotNull을 사용하면서 nullable하게 설정하지 않으면 역직렬화에서 막혀버리는군요.
모든 request에 NotNull 어노테이션이 들어가는게 올바른 방식만은 아닐 것 같아, 차후에 HttpMessageNotReadableException일 경우 따로 처리하는 예외를 만드는게 나아보인다는 생각도 드네요. null을 허용하지 않은 필드인데 request 스펙 자체를 지키지 않은거니까요. 이에 대해서는 어떻게 생각하시나요?
++ 추가적으로 BaseEntity 필드가 LocalDateTime이 아닌 LocalDate로 되어있습니다..!