Skip to content

Add HTTP 400 Bad Request as a possible generic error response #1165

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

Merged
merged 1 commit into from
Jul 3, 2023
Merged

Add HTTP 400 Bad Request as a possible generic error response #1165

merged 1 commit into from
Jul 3, 2023

Conversation

arttuperala
Copy link
Contributor

Description of the Change

Adds 400 Bad Request as a possible error response, as JSON:API specification says to use it for requests with bad include / sort or otherwise illegal query parameters, and advocates using it as an appropriate status code for multiple 4xx errors. DJA's documentation also mentions 400 Bad Request multiple times, so it's a bit weird if it's not documented as a possible response.

Discovered during an OpenAPI schema validation run as our generic error responses were not found in the schema.

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 in AUTHORS

Copy link
Member

@sliverc sliverc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Indeed, that makes sense. Merging.

@sliverc sliverc merged commit 39a9c92 into django-json-api:main Jul 3, 2023
@arttuperala arttuperala deleted the openapi-400-bad-request branch July 6, 2023 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants