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

Add support for excerpt projections [DATAREST-317] #697

Closed
spring-projects-issues opened this issue Jun 12, 2014 · 0 comments
Closed

Add support for excerpt projections [DATAREST-317] #697

spring-projects-issues opened this issue Jun 12, 2014 · 0 comments
Assignees
Labels
type: enhancement

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Jun 12, 2014

Oliver Drotbohm opened DATAREST-317 and commented

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-221 for 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 : "…" }
  }
}

No further details from DATAREST-317

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

No branches or pull requests

2 participants