From 03959a43329dbdfc85c8ea050cc332a9c08dd0c3 Mon Sep 17 00:00:00 2001 From: Aaron Harper Date: Wed, 9 Jun 2021 13:53:31 -0400 Subject: [PATCH] Fix inline enum only string literal (#445) Co-authored-by: Aaron Harper --- datamodel_code_generator/types.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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