MCPcopy
hub / github.com/pydantic/pydantic / function_wrap_schema

Method function_wrap_schema

pydantic/json_schema.py:1159–1171  ·  view source on GitHub ↗

Generates a JSON schema that matches a function-wrap schema. Args: schema: The core schema. Returns: The generated JSON schema.

(self, schema: core_schema.WrapValidatorFunctionSchema)

Source from the content-addressed store, hash-verified

1157 )
1158
1159 def function_wrap_schema(self, schema: core_schema.WrapValidatorFunctionSchema) -> JsonSchemaValue:
1160 """Generates a JSON schema that matches a function-wrap schema.
1161
1162 Args:
1163 schema: The core schema.
1164
1165 Returns:
1166 The generated JSON schema.
1167 """
1168 if self.mode == 'validation' and (input_schema := schema.get('json_schema_input_schema')):
1169 return self.generate_inner(input_schema)
1170
1171 return self.generate_inner(schema['schema'])
1172
1173 def default_schema(self, schema: core_schema.WithDefaultSchema) -> JsonSchemaValue:
1174 """Generates a JSON schema that matches a schema with a default value.

Callers

nothing calls this directly

Calls 2

generate_innerMethod · 0.95
getMethod · 0.45

Tested by

no test coverage detected