mirror of
https://github.com/PaiGramTeam/sqlmodel.git
synced 2024-11-21 22:58:22 +00:00
fix _is_field_noneable
This commit is contained in:
parent
6e89ad374b
commit
6b7925d8ce
@ -666,14 +666,15 @@ def _is_field_noneable(field: FieldInfo) -> bool:
|
||||
return field.nullable
|
||||
if not field.is_required():
|
||||
default = getattr(field, "original_default", field.default)
|
||||
if default is PydanticUndefined:
|
||||
return False
|
||||
if field.annotation is None or field.annotation is NoneType:
|
||||
return True
|
||||
if _is_optional_or_union(field.annotation):
|
||||
for base in get_args(field.annotation):
|
||||
if base is NoneType:
|
||||
return True
|
||||
if default is PydanticUndefined:
|
||||
return False
|
||||
|
||||
return False
|
||||
return False
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user