MCPcopy
hub / github.com/pydantic/pydantic / get_flattened_anyof

Method get_flattened_anyof

pydantic/json_schema.py:2408–2418  ·  view source on GitHub ↗
(self, schemas: list[JsonSchemaValue])

Source from the content-addressed store, hash-verified

2406 }
2407
2408 def get_flattened_anyof(self, schemas: list[JsonSchemaValue]) -> JsonSchemaValue:
2409 members = []
2410 for schema in schemas:
2411 if len(schema) == 1 and 'anyOf' in schema:
2412 members.extend(schema['anyOf'])
2413 else:
2414 members.append(schema)
2415 members = _deduplicate_schemas(members)
2416 if len(members) == 1:
2417 return members[0]
2418 return {'anyOf': members}
2419
2420 def get_json_ref_counts(self, json_schema: JsonSchemaValue) -> dict[JsonRef, int]:
2421 """Get all values corresponding to the key '$ref' anywhere in the json_schema."""

Callers 1

get_union_of_schemasMethod · 0.95

Calls 1

_deduplicate_schemasFunction · 0.85

Tested by

no test coverage detected