In the ExceptionHandler for MethodArgumentNotValidExceptions a way for getting the serialized names of the violated fields is missing. Using MethodArgumentNotValidException.getBindingResult().getAllErrors() ... FieldError.getField() the POJO's name is returned which is not acceptable for the response body in case of different serialized names (Example: photoUrls vs. photo-urls).
Code:
@JsonProperty("photo-urls")
private List<URL> photoUrls;
In this case photoUrls is returned which is the wrong key for the client's request.
In the
ExceptionHandlerforMethodArgumentNotValidExceptionsa way for getting the serialized names of the violated fields is missing. UsingMethodArgumentNotValidException.getBindingResult().getAllErrors()...FieldError.getField()the POJO's name is returned which is not acceptable for the response body in case of different serialized names (Example:photoUrlsvs.photo-urls).Code:
In this case
photoUrlsis returned which is the wrong key for the client's request.