field is required by default, while nullable=True for Column

This commit is contained in:
honglei 2023-08-16 22:32:28 +08:00
parent 6a5f373862
commit 72dc89d92b

View File

@ -668,7 +668,7 @@ def _is_field_noneable(field: FieldInfo) -> bool:
default = getattr(field, "original_default", field.default)
if default is None:
return True
elif default is not PydanticUndefined:
elif default is PydanticUndefined:
return False
if field.annotation is None or field.annotation is NoneType:
return True