diff --git a/datamodel_code_generator/types.py b/datamodel_code_generator/types.py index 800938e7f..97a002455 100644 --- a/datamodel_code_generator/types.py +++ b/datamodel_code_generator/types.py @@ -16,6 +16,7 @@ Tuple, Type, TypeVar, + Union, ) from pydantic import create_model @@ -71,7 +72,7 @@ class DataType(_BaseModel): is_dict: bool = False is_list: bool = False is_custom_type: bool = False - literals: List[str] = [] + literals: List[Union[int, str]] = [] use_standard_collections: bool = False use_generic_container: bool = False alias: Optional[str] = None