MCPcopy
hub / github.com/pydantic/pydantic / url_schema

Method url_schema

pydantic/json_schema.py:2049–2060  ·  view source on GitHub ↗

Generates a JSON schema that matches a schema that defines a URL. Args: schema: The core schema. Returns: The generated JSON schema.

(self, schema: core_schema.UrlSchema)

Source from the content-addressed store, hash-verified

2047 return content_json_schema
2048
2049 def url_schema(self, schema: core_schema.UrlSchema) -> JsonSchemaValue:
2050 """Generates a JSON schema that matches a schema that defines a URL.
2051
2052 Args:
2053 schema: The core schema.
2054
2055 Returns:
2056 The generated JSON schema.
2057 """
2058 json_schema = {'type': 'string', 'format': 'uri', 'minLength': 1}
2059 self.update_with_validations(json_schema, schema, self.ValidationsMapping.string)
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.

Callers 15

match_typeMethod · 0.80
url_validatorFunction · 0.80
test_urlFunction · 0.80
test_url_dict_keysFunction · 0.80
test_url_okFunction · 0.80
url_validator_fixtureFunction · 0.80
test_trailing_slashFunction · 0.80
test_url_host_requiredFunction · 0.80
test_max_lengthFunction · 0.80

Calls 1

Tested by 15

url_validatorFunction · 0.64
test_urlFunction · 0.64
test_url_dict_keysFunction · 0.64
test_url_okFunction · 0.64
url_validator_fixtureFunction · 0.64
test_trailing_slashFunction · 0.64
test_url_host_requiredFunction · 0.64
test_max_lengthFunction · 0.64
test_allowed_schemes_okFunction · 0.64