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

Fix the format_errors bug when response data is None#1229

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

Open
ericinfins wants to merge3 commits intodjango-json-api:main
base:main
Choose a base branch
Loading
fromericinfins:fix/empty-data-in-response-using-rest-action

Conversation

ericinfins
Copy link

@ericinfinsericinfins commentedMay 31, 2024
edited
Loading

Fixes #

Related to the PR:#1121
Add the test case to support it

Description of the Change

Fix: TypeError: object of type 'NoneType' has no len()

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

@ericinfinsericinfins changed the titlefix the format_errors bug when data is NoneFix the format_errors bug when response data is NoneMay 31, 2024
@sliverc
Copy link
Member

Thanks for following up on this. I will take a look at it at some point and will give you feedback. Just writing to let you know that I saw it.

ericinfins reacted with thumbs up emoji

@sliverc
Copy link
Member

I have finally got around to take a look at this. Great to see how this can be reproduced by using vanilla DRF classes.

It is though as I expected that this fix does avoid the exception, however the output of the fix is notJSON:API compliant. It simply returns

{"errors":None}

but the value of errors needs to be a list and each error object must at least have one member. I think the easiest is to add a single error object with the status code as a string.

@n2ygkn2ygk mentioned this pull requestJan 7, 2025
5 tasks
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@ericinfins@sliverc

[8]ページ先頭

©2009-2025 Movatter.jp