bind() included resources
See original GitHub issueIncluded resources that are instantiated in extract_included
under renders.py
doesn’t bind
fields field_name
and parent
.
I don’t have a definitive use case yet, but sometimes it’s needed to understand the tree structure of serializers.
https://github.com/django-json-api/django-rest-framework-json-api/blob/0892e3a8a4dbad9630d70e2b78e18b242a8b057d/rest_framework_json_api/renderers.py#L322 https://github.com/django-json-api/django-rest-framework-json-api/blob/0892e3a8a4dbad9630d70e2b78e18b242a8b057d/rest_framework_json_api/renderers.py#L342
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Binding as a Resource - wpf - Stack Overflow
Direct answer to your question is "yes, you can define a binding as a resource". The problem here is how do you then...
Read more >Binding Resource | Twilio
Full API reference for the Binding resource in the Twilio Notify API. Learn how to create, fetch (get), read (list), and delete Binding...
Read more >4. BIND 9 Configuration Reference
Types of Resource Records and When to Use Them ... The include statement facilitates the administration of configuration files by permitting the reading...
Read more >Resource binding overview - Win32 apps | Microsoft Learn
Create one or more root signature objects – one for every different binding configuration an application needs. Create shaders and pipeline ...
Read more >Function.prototype.bind() - JavaScript - MDN Web Docs - Mozilla
The bind() method creates a new function that, when called, ... The bound function will store the parameters passed — which include the ......
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
JSON API spec resp. DJA follows REST principles. One of the REST constraint is uniform interface
The compound document feature in JSON API spec is basically a feature to avoid too many http request but the resource as such remains the same as when fetched through its own end point.
In your example
PostDetailSerializer
when called per include query parameter does not serialize everything in its representation (body is missing). An API user therefore has a resource which does not contain everything but how should a user know what is missing? They can’t as the resource has a unique id and per REST guideline it is expected to always get the full resource (JS framework such as ember.js heavily rely on this convention for caching of resources for instance).A pitfall to be avoided. If it is a real concern that the body is too large what I would do in your example is to create another resource
postBody
and move the content of the body to that resource. This can then additionally be included aspost.body
and the api user can decide whether they need it or not.I hope this makes a bit clearer why those parameters are not binded.
I am closing this issue therefore. If there are any other comments or example on how to use those parameters please feel free to comment. We can always reopen the issue again.
I do not know your complete use case but I am not sure it is a good idea to have
posts
onCategory
as this might end up to be a really large request (with or without includes). Another solution is to have a filtercategory
on thepost
end point which can be called when you want to show all posts of a certain category.