Resolving JSON References¶
RefResolver(base_uri, referrer, store=(), cache_remote=True, handlers=(), urljoin_cache=None, remote_cache=None)¶
Resolve JSON References.
base_uri (str) – The URI of the referring document
referrer – The actual referring document
store (dict) – A mapping from URIs to documents to cache
cache_remote (bool) – Whether remote refs should be cached after first resolution
handlers (dict) – A mapping from URI schemes to functions that should be used to retrieve them
functools.lru_cache()) – A cache that will be used for caching the results of joining the resolution scope to subscopes.
functools.lru_cache()) – A cache that will be used for caching the results of resolved remote URLs.
Retrieve the current base URI, not including any fragment.
from_schema(schema, id_of=<function _id_of>, *args, **kwargs)¶
Construct a resolver from a JSON schema object.
schema – the referring schema
Temporarily enter the given scope for the duration of the context.
Exit the most recent entered scope.
Treats further dereferences as being performed underneath the original scope.
Don’t call this method more times than
push_scopehas been called.
Enter a given sub-scope.
Treats further dereferences as being performed underneath the given scope.
Retrieve the current resolution scope.
Resolve the given reference.
fragmentwithin the referenced
document – The referent document
fragment (str) – a URI fragment to resolve within it
Resolve the given remote URL.
Resolve a remote
If called directly, does not check the store first, but after retrieving the document at the specified URI it will be saved in the store if
If the requests library is present,
jsonschemawill use it to request the remote
uri, so that the correct encoding is detected and used.
If it isn’t, or if the scheme of the
https, UTF-8 is assumed.
uri (str) – The URI to resolve
The retrieved document
A ref could not be resolved.
A JSON reference failed to resolve.