- Notifications
You must be signed in to change notification settings - Fork302
Ensured that patching a To-Many relationship correctly raises request error#1251
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
To see failing drf master tests, go tohttps://github.com/django-json-api/django-rest-framework-json-api/actions/runs/10648325051/job/29517253464 open Run tox targets and scroll down to drfmaster tests. These tests have been failing for a while and as we ignore failing drfmaster tests, it is hard to notice it. Possibly have to think about it not to ignore it (as it hardly ever happens that it fails). And if one PR suddenly fails because of DRF changes, we can always force merge it. Anyway, there might be also other approaches, but that would be part of another PR/discussion. |
e745d6b
intodjango-json-api:mainUh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Description of the Change
As of DRF upstream changeencode/django-rest-framework#9455 our current tests with DRF master are failing. The reason being is that previous to the above change, parser attribute errors would get swallowed.
After this upstream change it occurred that we actually have an error in our code that an attribute error gets hidden and instead of raising a 500-error the code would just continue.
This happened when patching a To-Many relationship with
RelationshipView
withNone
. However, theJSON:API spec defines that for emptying a To-Many relationship, caller needs to pass empty array instead of None.So this PR ensures that when passing on
None
when patching To-Many relationship, a proper request error (400) is returned instead of 500.Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS