Resolution Scope

class jsl.resolutionscope.ResolutionScope(base='', current='', output='')[source]

An utility class to help with translating id attributes of fields into JSON schema "id" properties.

Parameters:
  • base (str) – A URI, a resolution scope of the outermost schema.
  • current (str) – A URI, a resolution scope of the current schema.
  • output (str) – A URI, an output part (expressed by parent schema id properties) scope of the current schema.
base

A resolution scope of the outermost schema.

current

A resolution scope of the current schema.

output

An output part (expressed by parent schema id properties) scope of the current schema.

replace(current=None, output=None)[source]

Returns a copy of the scope with the current and output scopes replaced.

alter(field_id)[source]

Returns a pair, where the first element is the identifier to be used as a value for the "id" JSON schema field and the second is a new ResolutionScope to be used when visiting the nested fields of the field with id field_id.

Return type:(str, ResolutionScope)
create_ref(definition_id)[source]

Returns a reference ({"$ref": ...}) relative to the base scope.

jsl.resolutionscope.EMPTY_SCOPE

An empty ResolutionScope.