Skip to content

Commit

Permalink
bugfix: response codes must be string. closes #17
Browse files Browse the repository at this point in the history
  • Loading branch information
tfranzel committed Mar 30, 2020
1 parent 5b7e464 commit 61b2c95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion drf_spectacular/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ def _get_response_bodies(self, path, method):
elif isinstance(response_serializers, dict):
# custom handling for overriding default return codes with @extend_schema
return {
code: self._get_response_for_code(path, method, serializer)
str(code): self._get_response_for_code(path, method, serializer)
for code, serializer in response_serializers.items()
}
else:
Expand Down
12 changes: 6 additions & 6 deletions tests/test_extend_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,21 @@ paths:
- {}
deprecated: true
responses:
201:
'201':
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Beta'
description: ''
200:
'200':
content:
application/json:
schema:
$ref: '#/components/schemas/Gamma'
description: ''
500:
'500':
content:
application/json:
schema:
Expand Down Expand Up @@ -94,7 +94,7 @@ paths:
- basicAuth: []
- {}
responses:
201:
'201':
description: No response body
/doesitall/manual/:
post:
Expand Down Expand Up @@ -166,7 +166,7 @@ paths:
- basicAuth: []
- {}
responses:
204:
'204':
description: No response body
/doesitall/serializer-query/:
get:
Expand Down Expand Up @@ -222,7 +222,7 @@ paths:
- basicAuth: []
- {}
responses:
201:
'201':
description: No response body
components:
securitySchemes:
Expand Down

0 comments on commit 61b2c95

Please sign in to comment.