Skip to content

Commit

Permalink
remove type-ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
svlyubovsk committed Nov 26, 2024
1 parent e51c263 commit 8f8c7c7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions litestar/_openapi/schema_generation/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -566,12 +566,13 @@ def for_enum_field(
A schema or reference instance.
"""
enum_type: None | OpenAPIType | list[OpenAPIType] = None
if issubclass(field_definition.annotation, str): # StrEnum
enum_type = OpenAPIType.STRING
elif issubclass(field_definition.annotation, int): # IntEnum
enum_type = OpenAPIType.INTEGER
if issubclass(field_definition.annotation, Enum):
if issubclass(field_definition.annotation, str): # StrEnum
enum_type = OpenAPIType.STRING
elif issubclass(field_definition.annotation, int): # IntEnum
enum_type = OpenAPIType.INTEGER

enum_values: list[Any] = [v.value for v in field_definition.annotation] # pyright: ignore
enum_values: list[Any] = [v.value for v in field_definition.annotation]
if enum_type is None:
enum_type = _types_in_list(enum_values)

Expand Down

0 comments on commit 8f8c7c7

Please sign in to comment.