Closed sliverc closed 5 months ago
@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.
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