MCPcopy
hub / github.com/pydantic/pydantic / multi_host_url_schema

Method multi_host_url_schema

pydantic/json_schema.py:2062–2074  ·  view source on GitHub ↗

Generates a JSON schema that matches a schema that defines a URL that can be used with multiple hosts. Args: schema: The core schema. Returns: The generated JSON schema.

(self, schema: core_schema.MultiHostUrlSchema)

Source from the content-addressed store, hash-verified

2060 return json_schema
2061
2062 def multi_host_url_schema(self, schema: core_schema.MultiHostUrlSchema) -> JsonSchemaValue:
2063 """Generates a JSON schema that matches a schema that defines a URL that can be used with multiple hosts.
2064
2065 Args:
2066 schema: The core schema.
2067
2068 Returns:
2069 The generated JSON schema.
2070 """
2071 # Note: 'multi-host-uri' is a custom/pydantic-specific format, not part of the JSON Schema spec
2072 json_schema = {'type': 'string', 'format': 'multi-host-uri', 'minLength': 1}
2073 self.update_with_validations(json_schema, schema, self.ValidationsMapping.string)
2074 return json_schema
2075
2076 def uuid_schema(self, schema: core_schema.UuidSchema) -> JsonSchemaValue:
2077 """Generates a JSON schema that matches a UUID.

Calls 1