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

PUT of entity with links fails..

Open
#80 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
Dominant language
Java
Stars
958
Forks
568
PR merge metrics
No merged PRs in 30d

Description

Hi Jon,
when I am doing a put to the self link with embedded links I get an error. This means I need to remove all links before putting an element. I think this should not be the desired behaviour. Or?

Sample:

{
   "description":"adasdadsasdads",
   "name":"Customer Corp",
   "links":[
      {
         "rel":"self",
         "href":"http://localhost:8080/web/api/customer/1"
      },
      {
         "rel":"customer.customer.users",
         "href":"http://localhost:8080/web/api/customer/1/users"
      },
      {
         "rel":"customer.customer.credentials",
         "href":"http://localhost:8080/web/api/customer/1/credentials"
      },
      {
         "rel":"customer.customer.addresses",
         "href":"http://localhost:8080/web/api/customer/1/addresses"
      },
      {
         "rel":"customer.customer.sector",
         "href":"http://localhost:8080/web/api/customer/1/sector"
      }
   ]
}

The response is:

{
  "cause" : null,
  "message" : "Property 'links' not found for entity de.model.customer.Customer"
}

Perhaps one additional note: the same happens, when using embedded entities like you described here: http://stackoverflow.com/questions/12879975/spring-data-rest-uri-vs-entity-id. Of course the POST fails, if I remove the links as the exporter is not able to find the customer in the database.

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.

Research direction

Reproduce the PUT against the self link using the supplied customer JSON with embedded links, then inspect the Spring Data REST request handling around the reported "Property 'links' not found" response. Compare this with the embedded-entity POST case described in the issue and establish the expected behavior for links before adding a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.