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

Patching to a map resets a linked resource contents. [DATAREST-314]

Open
#694 0 comments 0 reactions 1 assignee View on GitHub

@odrotbohm is already working on this.

Since Dec 31, 2020.

type: task
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

David Cusack opened DATAREST-314 and commented

Edit: It was an issue with with the model inside the application. This issue can be removed apologies.

Summary

Patching to a map resets a linked resource contents.

Versions

Ran on OSX with Tomcat7.
Spring version: 4.0.3
Spring data rest: 2.1.0.RELEASE

If i have a URI like the following http://localhost:8080/api/mapAttributes/4 which has the below contents

{
"dateCreated": 1402063064378,
"createdBy": "test@test.com",
"dateLastUpdated": 1402063064378,
"updatedBy": "test@test.com",
"id": 4,
"version": 1,
"encrypted": false,
"overridable": true,
"_links": {
"self": {
"href": "http://localhost:8080/api/mapAttributes/4"
},
"contents": {
"href": "http://localhost:8080/api/mapAttributes/4/contents"
}
}
}

And I make a HTTP patch request with the following URI and json content

http://localhost:8080/api/mapAttributes/4

Content-Type: application/json

{
"overridable":false
}

it will update the value i'm trying to PATCH however it also empties whatever is in the http://localhost:8080/api/mapAttributes/4/contents URI.

And will look like the following

{
"content" : { }
}


Affects: 2.1 GA (Dijkstra)

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.