Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Support for deeply-nested included resources?#957

Answeredbysliverc
esmail asked this question inQ&A
Discussion options

Taking the familiar example of a blog post/article, would it be possible to return both the comments on the articleand the authors of those comments?

The following quote (emphasis mine) leads me to believe this use case to be in-spec., but I'm not sure how to do so with DJA:

Note: Full linkage ensures that included resources are related to either the primary data (which could be resource objects or resource identifier objects)or to each other.

https://jsonapi.org/format/#document-compound-documents

You must be logged in to vote

Yes this is possible as perspecification include needs to be defined dotted.

So for your example the include query parameter should look like this:

GET /articles/1?include=comments.author HTTP/1.1

For this to work you defineincluded_serializers in your serializers as perdocumentation.

Replies: 1 comment 1 reply

Comment options

Yes this is possible as perspecification include needs to be defined dotted.

So for your example the include query parameter should look like this:

GET /articles/1?include=comments.author HTTP/1.1

For this to work you defineincluded_serializers in your serializers as perdocumentation.

You must be logged in to vote
1 reply
@esmail
Comment options

Forgot to say thanks for this. I was mistakenly thinking I needed to somehow referenceauthor inMySerializer.Meta.fields. I'll try to circle back and PR in a quick mention of the in the docs.

Answer selected byesmail
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@esmail@sliverc
Converted from issue

This discussion was converted from issue #952 on July 06, 2021 18:46.


[8]ページ先頭

©2009-2025 Movatter.jp