Document include options for Compound Documents
See original GitHub issueWith #250 pulled in we now have options to include relations to form compound documents:
- Include resources related to the primary data by default.
- Include resources related to the primary data through use of a request parameter which customizes which related resources should be returned
Example Current Implementation
- default include
posts
class UserSerializer(serializers.Serializer):
name = serializers.CharField(max_length=200)
# PostSerializer included directly on the serializer
posts = PostSerializer(many=True, read_only=True)
class JSONAPIMeta:
# included_resources specifys resources to include by default
included_resources = ['posts']
- param include
posts
class UserSerializer(serializers.Serializer):
name = serializers.CharField(max_length=200)
# PostSerializer NOT included directly on the serializer, ResourceRelatedField is
# specified as default
posts = relations.ResourceRelatedField(
source='post_set', many=True, read_only=True)
# specifies serializer to use when passing in the `include` param
included_serializers = {
'posts': PostSerializer,
}
We should probably document this. We can even copy the examples above with a bit of explanation.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Working with compound documents - IBM
Working with compound documents. Table 1. This table provides the available procedures you can perform when working with parent and child documents.
Read more >Compound Documents - CloudNine Answer Center
Compound documents are composed of a container document and embedded documents. For example, a Word document may contain an embedded spreadsheet.
Read more >Compound Documents - Win32 apps | Microsoft Learn
OLE compound documents enable users working within a single application to manipulate data written in various formats and derived from multiple ...
Read more >Compound document - Wikipedia
Compound documents are often produced using word processing software, and may include text and non-text elements such as barcodes, spreadsheets, pictures, ...
Read more >CompoundDocuments
A compound document contains various types of information (formatted text, ... Compound documents are stored in binary files with the .odc extension.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Since this was still open, I took a crack at documenting it in PR #308.
Thanks for this. I had to find this post to make sense of included records. It would be great to get some official documentation for this. It’s a common pattern for sideloading data in Ember for example