minor fixes
This commit is contained in:
@@ -86,13 +86,16 @@ class BotEntityMetaclass(SQLModelMetaclass):
|
||||
field_descriptor.is_list = is_list = True
|
||||
field_descriptor.type_base = type_ = get_args(type_)[0]
|
||||
|
||||
if type_origin == Union and isinstance(get_args(type_)[0], ForwardRef):
|
||||
field_descriptor.is_optional = is_optional = True
|
||||
field_descriptor.type_base = type_ = get_args(type_)[
|
||||
0
|
||||
].__forward_arg__
|
||||
if type_origin is Union:
|
||||
args = get_args(type_)
|
||||
if isinstance(args[0], ForwardRef):
|
||||
field_descriptor.is_optional = is_optional = True
|
||||
field_descriptor.type_base = type_ = args[0].__forward_arg__
|
||||
elif args[1] is NoneType:
|
||||
field_descriptor.is_optional = is_optional = True
|
||||
field_descriptor.type_base = type_ = args[0]
|
||||
|
||||
if type_origin == UnionType and get_args(type_)[1] == NoneType:
|
||||
if type_origin is UnionType and get_args(type_)[1] is NoneType:
|
||||
field_descriptor.is_optional = is_optional = True
|
||||
field_descriptor.type_base = type_ = get_args(type_)[0]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user