diff --git a/beanie/odm/fields.py b/beanie/odm/fields.py index e281944e..f8423f14 100644 --- a/beanie/odm/fields.py +++ b/beanie/odm/fields.py @@ -147,7 +147,7 @@ def __get_pydantic_core_schema__( cls, source_type: Any, handler: GetCoreSchemaHandler ) -> CoreSchema: # type: ignore return core_schema.json_or_python_schema( - python_schema=core_schema.general_plain_validator_function( + python_schema=core_schema.with_info_plain_validator_function( cls.validate ), json_schema=str_schema(), @@ -397,7 +397,7 @@ def __get_pydantic_core_schema__( cls, source_type: Any, handler: GetCoreSchemaHandler ) -> CoreSchema: # type: ignore return core_schema.json_or_python_schema( - python_schema=core_schema.general_plain_validator_function( + python_schema=core_schema.with_info_plain_validator_function( cls.build_validation(handler, source_type) ), json_schema=core_schema.typed_dict_schema( @@ -414,7 +414,7 @@ def __get_pydantic_core_schema__( lambda instance: cls.serialize(instance) # type: ignore ), ) - return core_schema.general_plain_validator_function( + return core_schema.with_info_plain_validator_function( cls.build_validation(handler, source_type) ) @@ -474,7 +474,7 @@ def validate(v: Union[DBRef, T], field): def __get_pydantic_core_schema__( cls, source_type: Any, handler: GetCoreSchemaHandler ) -> CoreSchema: # type: ignore - return core_schema.general_plain_validator_function( + return core_schema.with_info_plain_validator_function( cls.build_validation(handler, source_type) ) @@ -581,7 +581,7 @@ def validate(v, _): else: return IndexModelField(IndexModel(v)) - return core_schema.general_plain_validator_function(validate) + return core_schema.with_info_plain_validator_function(validate) else: