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

Linked Resources and "self" link [DATAREST-147]

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

@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

Thomas Darimont opened DATAREST-147 and commented

Github Author: mangvlad
Github Last-Updated: 2013-02-15T15:45:15Z
This issue was automatically imported from github

Let's say we have a Resource (A) that includes a reference to another Resource (B)(OneToOne).
The B resource belongs to a collection (C).
The use case is to display Resource A and a drop-down list that will display the name of the Resource B and other C Resources to pick from.

This currently will require 3 separate requests:

  1. Get Resource A from URL /A (this will include link to B like this /A/B)
  2. Get Resources C from URL /C (this will include B with link to self as /B)
  3. Get Resource B from /A/B (this will include link to self as /B) so we can find it in the collection

If this has to be done for many linked resources oh a large collection, it results in significant increase in traffic and degrades the performance.

Is there any way to include the actual link to B when returning A with links?

This:
{
links: {[{"rel":"B", "href":"/B" }]},
content: {...}
}

instead of current:
{
links: {[{"rel":"B", "href":"/A/B" }]},
content: {...}
}

Thanks


Reference URL: https://api.github.com/repos/SpringSource/spring-data-rest/issues/69

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.