Global Validation Errors are lost in RepositoryConstraintViolationExceptionMessage [DATAREST-832]
Pablo Andrés Grisafi opened DATAREST-832 and commented
RepositoryConstraintViolationExceptionMessage only uses field errors to create violation errors From the constructor:
for (FieldError fieldError : violationException.getErrors().getFieldErrors()) {
So global errors (the one you add with errors.reject instead of errors.rejectValue or ValidationUtils.rejectIf) are not mapped to ValidationError's, and do not show in json response
Or am I doing something wrong?
Affects: 2.5.1 (Hopper SR1)
6 votes, 8 watchers
René Reitmann commented
We have just upgraded spring boot from 1.3.6 to 1.4.1 (=> data-rest from 2.4.4 to 2.5.3) and now this issue becomes a bigger problem. We use JSR-303 validation and have configured the ValidatingRepositoryEventListener to validate with LocalValidatorFactoryBean beforeCreate and beforeSave. Class level JSR-303 annotations do now result in "global" errors which are therefore not sent to the client anymore. If I rollback to 1.3.6 I can see that class level annotations result in field errors with empty property name. Have there been any changes in Spring Core which might have caused this?
This is still an issue in 3.4.3
@odrotbohm thoughts?