适配 Pydantic V2

This commit is contained in:
2024-04-24 00:49:01 +08:00
parent 87c87ad231
commit 563564ac8d
5 changed files with 17 additions and 12 deletions

View File

@@ -30,7 +30,7 @@ class PydanticType(TypeDecorator):
if isinstance(value, str | bytes):
for i in self.get_model():
try:
return i.parse_raw(value)
return i.model_validate_json(value)
except ValidationError: # noqa: PERF203
...
raise TypeError