Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
n2ygk merged 1 commit intodjango-json-api:mainfromsliverc:patch_relationship
Sep 10, 2024

Conversation

sliverc
Copy link
Member

@slivercsliverc commentedSep 10, 2024
edited
Loading

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 withRelationshipView 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 onNone when patching To-Many relationship, a proper request error (400) is returned instead of 500.

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name inAUTHORS

@sliverc
Copy link
MemberAuthor

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.

@slivercsliverc reopened thisSep 10, 2024
@n2ygkn2ygk merged commite745d6b intodjango-json-api:mainSep 10, 2024
20 checks passed
@slivercsliverc deleted the patch_relationship branchSeptember 10, 2024 11:36
@slivercsliverc mentioned this pull requestOct 8, 2024
5 tasks
@slivercsliverc mentioned this pull requestJan 13, 2025
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@n2ygkn2ygkn2ygk approved these changes

Assignees

@n2ygkn2ygk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@sliverc@n2ygk

[8]ページ先頭

©2009-2025 Movatter.jp