spring-projects / spring-projects/spring-data-rest
Explicitly supplying null value on PATCH does not get applied [DATAREST-342]
Open
@odrotbohm is already working on this.
Since Dec 31, 2020.
type: bug
- Dominant language
- Java
- Stars
- 958
- Forks
- 568
- PR merge metrics
- No merged PRs in 30d
Description
Aaron Loes opened DATAREST-342 and commented
Given an existing farm:
{
"name" : "Old Macdonalds Farm",
"_links" : {
"self" : {
"href" : "http://localhost:8080/farms/1"
},
"animals" : {
"href" : "http://localhost:8080/farms/1/animals"
}
}
}
If i were to perform a PATCH where i would want to empty out our farms name:
{
"name" : null
}
this change will not get applied due to the null checking in DomainObjectMerger:
{
"name" : "Old Macdonalds Farm",
"_links" : {
"self" : {
"href" : "http://localhost:8080/farms/1"
},
"animals" : {
"href" : "http://localhost:8080/farms/1/animals"
}
}
}
To me this is wrong because i've made an explicit decision to null out a value and it will not be applied
Affects: 2.1.1 (Dijkstra SR1)
3 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.