spring-projects / spring-projects/spring-data-rest
Class level validation error messages are not sent to the client anymore [DATAREST-926]
@odrotbohm is already working on this.
Since Dec 31, 2020.
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
René Reitmann opened DATAREST-926 and 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 see the following issue: We do only use JSR-303 validations and have configured the ValidatingRepositoryEventListener to validate with LocalValidatorFactoryBean on beforeCreate and on beforeSave. After the upgrade, class level JSR-303 validation errors are not sent to the client anymore. However, field errors are sent to the client.
As mentionened here https://jira.spring.io/browse/DATAREST-832 there is (and has always been) a bug in RepositoryConstraintViolationExceptionMessage which only serializes field errors and no global errors. If I rollback spring boot to 1.3.6 (data-rest to 2.4.4) I can see that class level validation errors result in field errors with empty field name and are therefore serialized by RepositoryConstraintViolationExceptionMessage.
I assume that there has been a change in Spring core which causes class level validation errors to result in global errors and not in field errors anymore. Do you know something about such a change?
Affects: 2.5.4 (Hopper SR4)
Reference URL: https://jira.spring.io/browse/DATAREST-832
2 votes, 3 watchers
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.