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

Commit 21493c1

Browse files
js-nhsliverc
andauthored
Added HTTP 429 Too Many Requests as a possible generic error response (#1226)
* Add HTTP 429 Too Many Requests as a possible generic error response * Update CHANGELOG.md --------- Co-authored-by: Oliver Sauder <os@esite.ch>
1 parent 9d9e47b commit 21493c1

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

‎CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
Note that in line with [Django REST framework policy](https://www.django-rest-framework.org/topics/release-notes/),
99
any parts of the framework not mentioned in the documentation should generally be considered private API, and may be subject to change.
1010

11+
## [Unreleased]
12+
13+
### Added
14+
15+
* Added `429 Too Many Requests` as a possible error response in the OpenAPI schema.
16+
1117
## [7.0.0] - 2024年05月02日
1218

1319
### Added

‎example/tests/__snapshots__/test_openapi.ambr

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,16 @@
6868
}
6969
},
7070
"description": "[Resource does not exist](https://jsonapi.org/format/#crud-deleting-responses-404)"
71+
},
72+
"429": {
73+
"content": {
74+
"application/vnd.api+json": {
75+
"schema": {
76+
"$ref": "#/components/schemas/failure"
77+
}
78+
}
79+
},
80+
"description": "too many requests"
7181
}
7282
},
7383
"tags": [
@@ -264,6 +274,16 @@
264274
}
265275
},
266276
"description": "[Conflict]([Conflict](https://jsonapi.org/format/#crud-updating-responses-409)"
277+
},
278+
"429": {
279+
"content": {
280+
"application/vnd.api+json": {
281+
"schema": {
282+
"$ref": "#/components/schemas/failure"
283+
}
284+
}
285+
},
286+
"description": "too many requests"
267287
}
268288
},
269289
"tags": [
@@ -399,6 +419,16 @@
399419
}
400420
},
401421
"description": "not found"
422+
},
423+
"429": {
424+
"content": {
425+
"application/vnd.api+json": {
426+
"schema": {
427+
"$ref": "#/components/schemas/failure"
428+
}
429+
}
430+
},
431+
"description": "too many requests"
402432
}
403433
},
404434
"tags": [
@@ -546,6 +576,16 @@
546576
}
547577
},
548578
"description": "not found"
579+
},
580+
"429": {
581+
"content": {
582+
"application/vnd.api+json": {
583+
"schema": {
584+
"$ref": "#/components/schemas/failure"
585+
}
586+
}
587+
},
588+
"description": "too many requests"
549589
}
550590
},
551591
"tags": [
@@ -754,6 +794,16 @@
754794
}
755795
},
756796
"description": "[Conflict](https://jsonapi.org/format/#crud-creating-responses-409)"
797+
},
798+
"429": {
799+
"content": {
800+
"application/vnd.api+json": {
801+
"schema": {
802+
"$ref": "#/components/schemas/failure"
803+
}
804+
}
805+
},
806+
"description": "too many requests"
757807
}
758808
},
759809
"tags": [
@@ -1341,6 +1391,16 @@
13411391
}
13421392
},
13431393
"description": "not found"
1394+
},
1395+
"429": {
1396+
"content": {
1397+
"application/vnd.api+json": {
1398+
"schema": {
1399+
"$ref": "#/components/schemas/failure"
1400+
}
1401+
}
1402+
},
1403+
"description": "too many requests"
13441404
}
13451405
},
13461406
"tags": [

‎rest_framework_json_api/schemas/openapi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ def _add_generic_failure_responses(self, operation):
807807
for code, reason in [
808808
("400", "bad request"),
809809
("401", "not authorized"),
810+
("429", "too many requests"),
810811
]:
811812
operation["responses"][code] = self._failure_response(reason)
812813

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /