-
Notifications
You must be signed in to change notification settings - Fork 830
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
Introduce the included extension #1472
base: gh-pages
Are you sure you want to change the base?
Conversation
@somdoron, I think an extension that embeds related resource objects would make many JSON:API users happy. At this very moment, I don't think we're ready to adopt another extension into jsonapi.org, but that should not stop you from publishing this elsewhere in the interim. We will be making recommendations on jsonapi.org in the coming week about how we think extensions should be publicized and distributed. As for the content of this extension, it makes me very happy to see the community running with the idea of extensions. I'm glad the namespace language worked for you and that you've incorporated it correctly 👍 I think I would suggest three changes:
{
"data": {
"type": "articles",
"id": "1",
"attributes": {
"title": "JSON:API paints my bikeshed!"
},
"relationships": {
"author": {
"embed:data": {
"type": "people",
"id": "9",
"attributes": {
"firstName": "Dan",
"lastName": "Gebhardt",
"twitter": "dgeb"
},
"links": {
"self": "http://example.com/people/9"
}
},
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/articles/1/author"
}
}
},
"links": {
"self": "http://example.com/articles/1"
}
},
"links": {
"self": "http://example.com/articles/1?embed:related=author"
}
} My biggest concern with this extension would be in keeping the the dot-separated relationship syntax of the |
I'm not convinced there's an issue with having to search If something like @gabesullice's |
Provide an alternative to the top-level
included
member. The advantage of this approach is that it is easier for the consumer of the API to fetch the included data (instead of searching for it in the included member).The disadvantage is, that a resource may be embedded more than once.