MCPcopy
hub / github.com/pydantic/pydantic / update_with_validations

Method update_with_validations

pydantic/json_schema.py:2361–2374  ·  view source on GitHub ↗

Update the json_schema with the corresponding validations specified in the core_schema, using the provided mapping to translate keys in core_schema to the appropriate keys for a JSON schema. Args: json_schema: The JSON schema to update. core_schema: The core

(
        self, json_schema: JsonSchemaValue, core_schema: CoreSchema, mapping: dict[str, str]
    )

Source from the content-addressed store, hash-verified

2359 )
2360
2361 def update_with_validations(
2362 self, json_schema: JsonSchemaValue, core_schema: CoreSchema, mapping: dict[str, str]
2363 ) -> None:
2364 """Update the json_schema with the corresponding validations specified in the core_schema,
2365 using the provided mapping to translate keys in core_schema to the appropriate keys for a JSON schema.
2366
2367 Args:
2368 json_schema: The JSON schema to update.
2369 core_schema: The core schema to get the validations from.
2370 mapping: A mapping from core_schema attribute names to the corresponding JSON schema attribute names.
2371 """
2372 for core_key, json_schema_key in mapping.items():
2373 if core_key in core_schema:
2374 json_schema[json_schema_key] = core_schema[core_key]
2375
2376 class ValidationsMapping:
2377 """This class just contains mappings from core_schema attribute names to the corresponding

Callers 11

int_schemaMethod · 0.95
float_schemaMethod · 0.95
str_schemaMethod · 0.95
bytes_schemaMethod · 0.95
list_schemaMethod · 0.95
tuple_schemaMethod · 0.95
_common_set_schemaMethod · 0.95
generator_schemaMethod · 0.95
dict_schemaMethod · 0.95
url_schemaMethod · 0.95
multi_host_url_schemaMethod · 0.95

Calls 1

itemsMethod · 0.45

Tested by

no test coverage detected