- Notifications
You must be signed in to change notification settings - Fork302
Ensured that no fields are returned when sparse fields is set to an empty value#1240
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I think the current behavior is supported by the spec:
If a client does not specify the set of fields for a given resource type, the server MAY send all fields, a subset of fields, or no fields for that resource type.
https://jsonapi.org/format/
8.4 Sparse Fieldsets
It could break a lot of implementations. Perhaps add a setting.
I agree that the sentence you mentioned is a bit ambiguous, however it would not make any sense to first specify that In any case, I have double-checked what was the behavior before change#1221. It turned out when defining an empty value it would also return no fields. So this means it is a regression and this PR will revert to the behavior we had before version 7.0.0. I have clarified this in the changelog as well now. |
d1163ce
intodjango-json-api:mainUh oh!
There was an error while loading.Please reload this page.
Thanks@n2ygk for merging. Let me prepare a release to get those regressions out of the way. |
Fixes#1238
Description of the Change
When a sparse field is set to an empty value no fields (attributes/relationships) should be rendered whereas currently it rendered all fields.
Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS