diff --git a/litestar/_openapi/schema_generation/schema.py b/litestar/_openapi/schema_generation/schema.py index 938d73a671..839fc66f97 100644 --- a/litestar/_openapi/schema_generation/schema.py +++ b/litestar/_openapi/schema_generation/schema.py @@ -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)