Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Note that in line with [Django REST framework policy](https://www.django-rest-framework.org/topics/release-notes/),
any parts of the framework not mentioned in the documentation should generally be considered private API, and may be subject to change.

## [Unreleased]

### Added

* Added `429 Too Many Requests` as a possible error response in the OpenAPI schema.

## [7.0.0] - 2024-05-02

### Added
Expand Down
60 changes: 60 additions & 0 deletions example/tests/__snapshots__/test_openapi.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,16 @@
}
},
"description": "[Resource does not exist](https://jsonapi.org/format/#crud-deleting-responses-404)"
},
"429": {
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "#/components/schemas/failure"
}
}
},
"description": "too many requests"
}
},
"tags": [
Expand Down Expand Up @@ -264,6 +274,16 @@
}
},
"description": "[Conflict]([Conflict](https://jsonapi.org/format/#crud-updating-responses-409)"
},
"429": {
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "#/components/schemas/failure"
}
}
},
"description": "too many requests"
}
},
"tags": [
Expand Down Expand Up @@ -399,6 +419,16 @@
}
},
"description": "not found"
},
"429": {
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "#/components/schemas/failure"
}
}
},
"description": "too many requests"
}
},
"tags": [
Expand Down Expand Up @@ -546,6 +576,16 @@
}
},
"description": "not found"
},
"429": {
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "#/components/schemas/failure"
}
}
},
"description": "too many requests"
}
},
"tags": [
Expand Down Expand Up @@ -754,6 +794,16 @@
}
},
"description": "[Conflict](https://jsonapi.org/format/#crud-creating-responses-409)"
},
"429": {
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "#/components/schemas/failure"
}
}
},
"description": "too many requests"
}
},
"tags": [
Expand Down Expand Up @@ -1341,6 +1391,16 @@
}
},
"description": "not found"
},
"429": {
"content": {
"application/vnd.api+json": {
"schema": {
"$ref": "#/components/schemas/failure"
}
}
},
"description": "too many requests"
}
},
"tags": [
Expand Down
1 change: 1 addition & 0 deletions rest_framework_json_api/schemas/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -807,6 +807,7 @@ def _add_generic_failure_responses(self, operation):
for code, reason in [
("400", "bad request"),
("401", "not authorized"),
("429", "too many requests"),
]:
operation["responses"][code] = self._failure_response(reason)

Expand Down