-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Closed
Labels
Milestone
Description
Bug report
When using python 3.11, instead of hardcoding HTTP verbs, now we can use official enum: HTTPMethod as well as HTTPStatus for statuses
What's wrong
We would like to use it in decorators.action(methods=[HTTPMethod.POST]) for instance.
Currently it does not work and produce the following error (with djangorestframework-stubs package):
error: List item 0 has incompatible type "Literal[HTTPMethod.POST]"; expected "Literal['GET', 'POST', 'DELETE', 'PUT', 'PATCH', 'TRACE', 'HEAD', 'OPTIONS', 'get', 'post', 'delete', 'put', 'patch', 'trace', 'head', 'options']" [list-item]How is that should be
No mypy error should be reported
System information
- OS: MacOS / Debian (docker)
pythonversion: 3.11djangoversion: 3.2.18mypyversion: 1.2.0django-stubsversion: 1.16.0djangorestframework-stubsversion: 1.10.0
Original issue:
The issue was originally reported against the stub project, but recommended to move the issue/discussion over here: typeddjango/djangorestframework-stubs#396
johnthagen