spring-projects / spring-projects/spring-data-rest

PUT/POST fail on unknown property different behavior [DATAREST-745]

Open
#1,097 3 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

in: repository status: feedback-provided type: bug
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.