MCPcopy
hub / github.com/pydantic/pydantic / new_handler_func

Method new_handler_func

pydantic/json_schema.py:558–570  ·  view source on GitHub ↗
(
                schema_or_field: CoreSchemaOrField,
                current_handler: GetJsonSchemaHandler = current_handler,
                js_modify_function: GetJsonSchemaFunction = js_modify_function,
            )

Source from the content-addressed store, hash-verified

556 for js_modify_function in metadata.get('pydantic_js_functions', ()):
557
558 def new_handler_func(
559 schema_or_field: CoreSchemaOrField,
560 current_handler: GetJsonSchemaHandler = current_handler,
561 js_modify_function: GetJsonSchemaFunction = js_modify_function,
562 ) -> JsonSchemaValue:
563 json_schema = js_modify_function(schema_or_field, current_handler)
564 if _core_utils.is_core_schema(schema_or_field):
565 json_schema = populate_defs(schema_or_field, json_schema)
566 original_schema = current_handler.resolve_ref_schema(json_schema)
567 ref = json_schema.pop('$ref', None)
568 if ref and json_schema:
569 original_schema.update(json_schema)
570 return original_schema
571
572 current_handler = _schema_generation_shared.GenerateJsonSchemaHandler(self, new_handler_func)
573

Callers

nothing calls this directly

Calls 2

resolve_ref_schemaMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected