support AnyURL

This commit is contained in:
honglei 2023-08-25 22:12:34 +08:00
parent cb6ccf4c07
commit 4213c978fc

View File

@ -461,8 +461,11 @@ def get_sqlalchemy_type(field: FieldInfo) -> Any:
# UrlConstraints(max_length=512,
# allowed_schemes=['smb', 'ftp', 'file']) ]
if type_ is pydantic.AnyUrl:
if field.metadata:
meta = field.metadata[0]
return AutoString(length=meta.max_length)
else:
return AutoString
org_type = get_origin(type_)
if org_type is Annotated: