MCPcopy
hub / github.com/pydantic/pydantic / list_schema

Method list_schema

pydantic/json_schema.py:957–969  ·  view source on GitHub ↗

Returns a schema that matches a list schema. Args: schema: The core schema. Returns: The generated JSON schema.

(self, schema: core_schema.ListSchema)

Source from the content-addressed store, hash-verified

955 return self.handle_invalid_for_json_schema(schema, 'core_schema.CallableSchema')
956
957 def list_schema(self, schema: core_schema.ListSchema) -> JsonSchemaValue:
958 """Returns a schema that matches a list schema.
959
960 Args:
961 schema: The core schema.
962
963 Returns:
964 The generated JSON schema.
965 """
966 items_schema = {} if 'items_schema' not in schema else self.generate_inner(schema['items_schema'])
967 json_schema = {'type': 'array', 'items': items_schema}
968 self.update_with_validations(json_schema, schema, self.ValidationsMapping.array)
969 return json_schema
970
971 @deprecated('`tuple_positional_schema` is deprecated. Use `tuple_schema` instead.', category=None)
972 @final

Calls 2

generate_innerMethod · 0.95