-
Notifications
You must be signed in to change notification settings - Fork 299
-
Taking the familiar example of a blog post/article, would it be possible to return both the comments on the article and 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.
Beta Was this translation helpful? Give feedback.
All reactions
Yes this is possible as per specification 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 define included_serializers in your serializers as per documentation.
Replies: 1 comment 1 reply
-
Yes this is possible as per specification 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 define included_serializers in your serializers as per documentation.
Beta Was this translation helpful? Give feedback.
All reactions
-
Forgot to say thanks for this. I was mistakenly thinking I needed to somehow reference author in MySerializer.Meta.fields. I'll try to circle back and PR in a quick mention of the in the docs.
Beta Was this translation helpful? Give feedback.