-
Notifications
You must be signed in to change notification settings - Fork 296
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
Release 7.0.0 breaks sparse fields request #1228
Comments
Thanks for the heads up. It seems in PR #1221 the url gets filtered out in the renderer but kept in the readable fields on the serialzer. Also actually id should be kept for overwriting id on a serialzer basis and not being filtered out when using sparse fields. Strange that the tests did not catch it. Do you see what the difference of your view and our sparse fieldset test could be? I will certainly need to analyze it more closely. |
I’ll try to code a test case in the next few days.
…On Fri, May 31, 2024 at 9:29 AM Oliver Sauder ***@***.***> wrote:
Thanks for the heads up. It seems in PR #1221
<#1221>
the url gets filtered out in the renderer but kept in the readable fields
on the serialzer. Also actually id should be kept for overwriting id on a
serialzer basis and not being filtered out when using sparse fields.
Strange that the tests did not catch it. Do you see what the difference of
your view and our sparse fieldset test could be?
I will certainly need to analyze it more closely.
—
Reply to this email directly, view it on GitHub
<#1228 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBHS557INPIYDGGNA4SEBLZFB3J5AVCNFSM6AAAAABIRWAH5OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBSGE3DQMZUGU>
.
You are receiving this because you authored the thread.Message ID:
<django-json-api/django-rest-framework-json-api/issues/1228/2142168345@
github.com>
|
I think the issue is the HyperlinkedModelSerializer which is not tested in our test suite :sniff: |
Yes agree. I can code a test.
…On Fri, May 31, 2024 at 10:20 AM Oliver Sauder ***@***.***> wrote:
I think the issue is the HyperlinkedModelSerializer which is not tested in
our test suite :sniff:
—
Reply to this email directly, view it on GitHub
<#1228 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABBHS53UZ36DCR2I4LDLRY3ZFCBLXAVCNFSM6AAAAABIRWAH5OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBSGMZTANRWGY>
.
You are receiving this because you authored the thread.Message ID:
<django-json-api/django-rest-framework-json-api/issues/1228/2142330666@
github.com>
|
sure sounds good. In case I will get to it earlier I will let you know. |
@sliverc I've been staring at these tests for a while and can't come up with a proper breaking test. Any suggestions? |
In the I might also see whether I get some more time to look into it later on today. |
Yeah I tried a few permutations of that but I think it also has to have a ResourceRelatedField and a ForeignKey model and using sparse fieldsets query.... I can try some more. |
I have some time at hand, let me give it a shot and I will let you know. |
Description of the Bug Report
As of release 7.0.0 a sparse fields request throws a KeyError for
url
atdjango-rest-framework-json-api/rest_framework_json_api/renderers.py
Lines 485 to 486 in 366769e
I expect that this is related to this change identified in the CHANGELOG:
django-rest-framework-json-api/CHANGELOG.md
Line 27 in 366769e
How to reproduce:
Use Postman with OAuth2 as described here:
Click Get New Access Token and login as user
admin
passadmin123
and Authorize then proceed and Use TokenSend GET http://localhost:8000/v1/courses/?fields[courses]=course_name
observe this error:
Then send GET http://localhost:8000//v1/courses/?fields[courses]=course_name,url
and get back a correct JSONAPI response.
Now ^C the runserver, downgrade to v6.1.0, and try again.
The text was updated successfully, but these errors were encountered: