From 44f9c3b3e52f782d39cf10a60933d0eab25e6470 Mon Sep 17 00:00:00 2001 From: Camillo Lugaresi Date: Tue, 27 Aug 2024 15:15:03 -0700 Subject: [PATCH] fix type annotation for 2.8.2 create_schema_validator now returns SchemaValidator | PluggableSchemaValidator --- ormar/models/mixins/save_mixin.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ormar/models/mixins/save_mixin.py b/ormar/models/mixins/save_mixin.py index e75949929..495f3b9e2 100644 --- a/ormar/models/mixins/save_mixin.py +++ b/ormar/models/mixins/save_mixin.py @@ -13,7 +13,10 @@ cast, ) -from pydantic.plugin._schema_validator import create_schema_validator +from pydantic.plugin._schema_validator import ( + PluggableSchemaValidator, + create_schema_validator, +) from pydantic_core import CoreSchema, SchemaValidator import ormar # noqa: I100, I202 @@ -36,7 +39,9 @@ class SavePrepareMixin(RelationMixin, AliasMixin): _json_fields: Set[str] _bytes_fields: Set[str] __pydantic_core_schema__: CoreSchema - __ormar_fields_validators__: Optional[Dict[str, SchemaValidator]] + __ormar_fields_validators__: Optional[ + Dict[str, SchemaValidator | PluggableSchemaValidator] + ] @classmethod def prepare_model_to_save(cls, new_kwargs: dict) -> dict: