Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUT does not apply new items in nested collection [DATAREST-956] #1326

Closed
spring-projects-issues opened this issue Dec 7, 2016 · 4 comments
Closed
Assignees
Labels
type: bug
Milestone

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Dec 7, 2016

Mathias D opened DATAREST-956 and commented

In the following scenario Parent and Child are entities and Item is either a Embeddable or an Entity. Only Parent has a repository that is also exported.

!http://www.yuml.me/diagram/scruffy/class/%2F%2F Cool Class Diagram, [Parent]->[Child], [Child]<>-*>[Item]!

PUT updates existing items but does not add new items.

Please see this project to reproduce the issue - https://github.com/mduesterhoeft/sdr-put-nested-list. See test ParentRestIntegrationTest#should_add_new_item


Here are the requests I am issuing:

  • Create parent
POST /parents -> 201
{
    "child": {
        "items": [
          {"some": "test"}]
    }
}
  • update parent
PUT /parents/id -> 204
{
    "child": {
        "items": [
          {"some": "test123"},
          {"some": "test1235"}]
    }
}

After the PUT the items collection still has size 1


Reference URL: #245

Issue Links:

  • DATAREST-958 PUT of Document with List<> fails to add entries post Hopper-SR5+
    ("is duplicated by")

Backported to: 2.6 RC1 (Ingalls), 2.5.6 (Hopper SR6)

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 7, 2016

Oliver Drotbohm commented

I am kind of wondering: do we actually have to issue the complex merge for PUT requests? Shouldn't the general ….readerForUpdate(…) give us exactly the semantics we need?

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 7, 2016

Oliver Drotbohm commented

To answer my own question: no we cannot as causes Jackson to wipe all nested fields. Nested ones annotated with e.g. @JsonIgnore are thus wiped, although they're not intended to be affected by any Jackson interaction

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 8, 2016

Mathias D commented

Ran my test scenario against the latest SNAPSHOT - It works now

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Dec 8, 2016

Oliver Drotbohm commented

👍 And thanks, again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug
Projects
None yet
Development

No branches or pull requests

2 participants