Details
-
Type:
New Feature
-
Status: Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 2.2 M1 (Evans)
-
Component/s: None
-
Labels:None
-
Sprint:48 - Dijkstra GA
Description
When representations are rendered in HAL, we currently render the complete entity in the _embedded clause for collection resources. If an item resource is accessed, we currently don't render an _embedded clause. This ticket suggests to allow to customize this behavior as follows.
- the user has means to identify a projection interface (see
DATAREST-221for the general mechanism) as an excerpt projection - for collection resources the excerpt will automatically rendered in _embedded clauses if an excerpt projection is in place
- for related resources, the excerpt projection will be rendered. If the value is rendered within an _embedded clause itself, the links to the related resource shall be omitted.
Example
class Author { public String name; public Set<Book> books; } class Book { public String title; public Set<Author> authors; } interface BooksExcerpt { String getTitle(); }
authors collection resource - full rendering of items but related resource's excerpt rendered embedded.
{ _embedded : { authors : [{ name : "Oliver Gierke", _embedded : { books : [{ title : "Spring Data" }] }, _links : { self : { href : "…" } } }] } }
author item resource - full rendering of item, related resource's excerpt rendered embedded, link to related resource present
{ name : "Oliver Gierke", _embedded : { books : [{ title : "Spring Data" }] }, _links : { self : { href : "…" }, books : { href : "…" } } }