gemseo / third_party / fastjsonschema

ref_resolver module

JSON Schema URI resolution scopes and dereferencing

https://tools.ietf.org/id/draft-zyp-json-schema-04.html#rfc.section.7

Code adapted from https://github.com/Julian/jsonschema

Classes:

RefResolver(base_uri, schema[, store, ...])

Resolve JSON References.

Functions:

normalize(uri)

resolve_path(schema, fragment)

Return definition from path.

resolve_remote(uri, handlers)

Resolve a remote uri.

class gemseo.third_party.fastjsonschema.ref_resolver.RefResolver(base_uri, schema, store={}, cache=True, handlers={})[source]

Bases: object

Resolve JSON References.

base_uri is URI of the referring document from the schema.

Methods:

from_schema(schema[, handlers])

Construct a resolver from a JSON schema object.

get_scope_name()

Get current scope and return it as a valid function name.

get_uri()

in_scope(scope)

Context manager to handle current scope.

resolving(ref)

Context manager which resolves a JSON ref and enters the resolution scope of this ref.

walk(node)

Walk thru schema and dereferencing id and $ref instances

classmethod from_schema(schema, handlers={}, **kwargs)[source]

Construct a resolver from a JSON schema object.

get_scope_name()[source]

Get current scope and return it as a valid function name.

get_uri()[source]
in_scope(scope)[source]

Context manager to handle current scope.

resolving(ref)[source]

Context manager which resolves a JSON ref and enters the resolution scope of this ref.

walk(node)[source]

Walk thru schema and dereferencing id and $ref instances

gemseo.third_party.fastjsonschema.ref_resolver.normalize(uri)[source]
gemseo.third_party.fastjsonschema.ref_resolver.resolve_path(schema, fragment)[source]

Return definition from path.

Path is unescaped according https://tools.ietf.org/html/rfc6901

gemseo.third_party.fastjsonschema.ref_resolver.resolve_remote(uri, handlers)[source]

Resolve a remote uri.

Note

Requests library is used to fetch http or https requests from the remote uri, if handlers does not define otherwise.

For unknown schemes urlib is used with UTF-8 encoding.