-
Notifications
You must be signed in to change notification settings - Fork 301
bind() included resources #901
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
Comments
Thanks for your report. The included feature of JSON API spec is a prefetching feature so basically an API user should be able to receive the same data in included as they would if they call the API of that entity separately. If a So without a definitive user case I wary to make this change in DJA. You said you do not have a definitive use case but do you have an idea of a use case where this could be helpful then? |
Let's say we have a If we want to include the Perhaps there is another solution that I don't know about... |
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 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 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. |
Something just came to my mind. Not directly related, but in shares the scope. Now as per JSON:API spec, included serializers must match with the data you get from the related URL. |
Another question: |
I do not know your complete use case but I am not sure it is a good idea to have |
Included resources that are instantiated in
extract_included
underrenders.py
doesn'tbind
fieldsfield_name
andparent
.I don't have a definitive use case yet, but sometimes it's needed to understand the tree structure of serializers.
django-rest-framework-json-api/rest_framework_json_api/renderers.py
Line 322 in 0892e3a
django-rest-framework-json-api/rest_framework_json_api/renderers.py
Line 342 in 0892e3a
The text was updated successfully, but these errors were encountered: