@@ -127,14 +127,6 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: GetCoreSchemaH
127127 if self .json_schema_input_type is PydanticUndefined
128128 else handler .generate_schema (self .json_schema_input_type )
129129 )
130- # Try to resolve the original schema if required, because schema cleaning
131- # won't inline references in metadata:
132- if input_schema is not None :
133- try :
134- input_schema = handler .resolve_ref_schema (input_schema )
135- except LookupError :
136- pass
137- metadata = {'pydantic_js_input_core_schema' : input_schema } if input_schema is not None else {}
138130
139131 info_arg = _inspect_validator (self .func , 'before' )
140132 if info_arg :
@@ -143,11 +135,13 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: GetCoreSchemaH
143135 func ,
144136 schema = schema ,
145137 field_name = handler .field_name ,
146- metadata = metadata ,
138+ json_schema_input_schema = input_schema ,
147139 )
148140 else :
149141 func = cast (core_schema .NoInfoValidatorFunction , self .func )
150- return core_schema .no_info_before_validator_function (func , schema = schema , metadata = metadata )
142+ return core_schema .no_info_before_validator_function (
143+ func , schema = schema , json_schema_input_schema = input_schema
144+ )
151145
152146 @classmethod
153147 def _from_decorator (cls , decorator : _decorators .Decorator [_decorators .FieldValidatorDecoratorInfo ]) -> Self :
@@ -229,13 +223,6 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: GetCoreSchemaH
229223 serialization = None
230224
231225 input_schema = handler .generate_schema (self .json_schema_input_type )
232- # Try to resolve the original schema if required, because schema cleaning
233- # won't inline references in metadata:
234- try :
235- input_schema = handler .resolve_ref_schema (input_schema )
236- except LookupError :
237- pass
238- metadata = {'pydantic_js_input_core_schema' : input_schema } if input_schema is not None else {}
239226
240227 info_arg = _inspect_validator (self .func , 'plain' )
241228 if info_arg :
@@ -244,14 +231,14 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: GetCoreSchemaH
244231 func ,
245232 field_name = handler .field_name ,
246233 serialization = serialization , # pyright: ignore[reportArgumentType]
247- metadata = metadata ,
234+ json_schema_input_schema = input_schema ,
248235 )
249236 else :
250237 func = cast (core_schema .NoInfoValidatorFunction , self .func )
251238 return core_schema .no_info_plain_validator_function (
252239 func ,
253240 serialization = serialization , # pyright: ignore[reportArgumentType]
254- metadata = metadata ,
241+ json_schema_input_schema = input_schema ,
255242 )
256243
257244 @classmethod
@@ -312,14 +299,6 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: GetCoreSchemaH
312299 if self .json_schema_input_type is PydanticUndefined
313300 else handler .generate_schema (self .json_schema_input_type )
314301 )
315- # Try to resolve the original schema if required, because schema cleaning
316- # won't inline references in metadata:
317- if input_schema is not None :
318- try :
319- input_schema = handler .resolve_ref_schema (input_schema )
320- except LookupError :
321- pass
322- metadata = {'pydantic_js_input_core_schema' : input_schema } if input_schema is not None else {}
323302
324303 info_arg = _inspect_validator (self .func , 'wrap' )
325304 if info_arg :
@@ -328,14 +307,14 @@ def __get_pydantic_core_schema__(self, source_type: Any, handler: GetCoreSchemaH
328307 func ,
329308 schema = schema ,
330309 field_name = handler .field_name ,
331- metadata = metadata ,
310+ json_schema_input_schema = input_schema ,
332311 )
333312 else :
334313 func = cast (core_schema .NoInfoWrapValidatorFunction , self .func )
335314 return core_schema .no_info_wrap_validator_function (
336315 func ,
337316 schema = schema ,
338- metadata = metadata ,
317+ json_schema_input_schema = input_schema ,
339318 )
340319
341320 @classmethod
0 commit comments