spring-projects / spring-projects/spring-data-rest
PUT/POST fail on unknown property different behavior [DATAREST-745]
@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
Simon C opened DATAREST-745 and commented
I've described my problem here.
In short, I am using custom ObjectMapper(enabled FAIL_ON_UNKNOWN_PROPERTIES) with Spring Data repositories. When i send POST request with unknown property in body, Spring throws exception as expected, however when I send PUT request with such prepared json, Spring ignores "fail on unknown properties" feature, saves entity to database and returns 200 OK.
I've reproduced this behavior by modifying http://spring.io/guides/gs/accessing-data-rest/ , the only change I've made is Jackson2ObjectMapperBuilder, no other controllers or repositories are in this project
Affects: 2.4.2 (Gosling SR2)
Reference URL: http://stackoverflow.com/questions/34545997
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.