Deeply Nested Relationship Inclusion
See original GitHub issueGET /articles/1?include=comments.author HTTP/1.1
Accept: application/vnd.api+json
Note: Because compound documents require full linkage (except when relationship linkage is excluded by sparse fieldsets), intermediate resources in a multi-part path must be returned along with the leaf nodes. For example, a response to a request for comments.author should include comments as well as the author of each of those comments.
Note: A server may choose to expose a deeply nested relationship such as comments.author as a direct relationship with an alias such as comment-authors. This would allow a client to request /articles/1?include=comment-authors instead of /articles/1?include=comments.author. By abstracting the nested relationship with an alias, the server can still provide full linkage in compound documents without including potentially unwanted intermediate resources.
Will also need to include support for Sparse Fieldsets of included relationships
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:7 (4 by maintainers)
Top GitHub Comments
There is definitely enough demand and motivation to begin work on this feature. Unless someone else gets to it first, I will likely begin working on it after some in-flight work is completed (#326, #340, #344). If someone else wants to begin work on this, feel free to ping me on the Gitter channel and I’ll be available to answer any questions.
I’d say this is an essential feature of jsonapi and is one of the biggest things that allows jsonapi to “compete” with features of graphql / custom-solutions.
nested includes is a must have for any generic jsonapi implementation (unless you’re netflix, apparently)