- Notifications
You must be signed in to change notification settings - Fork302
Ensured that URL and id field are kept when using sparse fields#1231
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
…fieldsURL field is considered a field in DRF but is not in JSON:API spectherefore we may not exclude it.ID on the other hand is a required field and may not be filtered.
@n2ygk I have finally figured it out. The URL field needs to be part of the fields in the serializer meta class for the error to happen. In the code where you found the error all fields are included and as it is a HyperlinkedModelSerializer URL is also part of it. Additionally, as mentioned before custom id was also affected by the same error which should be fixed with this PR as well. Could you try it out with the tutorial repo whether this PR works as expected? Thanks. |
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.
The fix worked. Looks good! Thanks for the quick turnaround.
Glad that it is working. Great that you brought this issue up and found it. That was an enlightening dive into our renderer once again. As this is a regression, let me create a new version. |
Fixes#1228
Description of the Change
URL field is considered a field in DRF but it is not in JSON:API spec therefore we may not exclude it during sparse fields. ID on the other hand is a required field and may not be filtered out either as we allow in DJA to overwrite primary key of model.
Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS