Create Direction type to allow more type-safe usage of direction #582
Labels
enhancement
New feature or request
fix confirmation pending
issue has been fixed and confirmation from issue reporter is pending
When writing an extension, I found an area that could be improved to help down stream developers that use type checking or IDEs (such as PyCharm) that support type annotations:
drf-spectacular/drf_spectacular/extensions.py
Line 61 in 59f9749
drf-spectacular/drf_spectacular/plumbing.py
Line 113 in 59f9749
Usage of
direction
throughout the codebase could be augmented with the use of a dedicatedDirection
Enum
orLiteral
type:Or
The
Literal
type was added in Python 3.8, so for supporting older versions, theytyping-extensions
package backports these in a PyPI package.Resulting code base would look like:
The text was updated successfully, but these errors were encountered: