Exceptions

class jsl.exceptions.SchemaGenerationException(message)[source]

Raised when a valid JSON schema can not be generated from a JSL object.

Examples of such situation are the following:

Note: this error can only happen if variables are used in a document or field description.

Parameters:message (str) – A message.
message = None

A message.

steps = None

A deque of steps, ordered from the first (the least specific) to the last (the most specific).

Steps

Steps attached to a SchemaGenerationException serve as a traceback and help a user to debug the error in the document or field description.

class jsl.exceptions.Step(entity, role='default')[source]

A step of the schema generation process that caused the error.

Parameters:
  • entity – An entity being processed.
  • role (str) – A current role.
entity = None

An entity being processed.

role = None

A current role.

class jsl.exceptions.DocumentStep(entity, role='default')[source]

Bases: jsl.exceptions.Step

A step of processing a document.

Parameters:
  • entity (subclass of Document) – An entity being processed.
  • role (str) – A current role.
class jsl.exceptions.FieldStep(entity, role='default')[source]

Bases: jsl.exceptions.Step

A step of processing a field.

Parameters:
  • entity (instance of BaseField) – An entity being processed.
  • role (str) – A current role.
class jsl.exceptions.AttributeStep(entity, role='default')[source]

Bases: jsl.exceptions.Step

A step of processing an attribute of a field.

entity is the name of an attribute (e.g., "properties", "additional_properties", etc.)

Parameters:
  • entity (str) – An entity being processed.
  • role (str) – A current role.
class jsl.exceptions.ItemStep(entity, role='default')[source]

Bases: jsl.exceptions.Step

A step of processing an item of an attribute.

entity is either a key or an index (e.g., it can be "created_at" if the current attribute is properties of a DictField or 0 if the current attribute is items of a ArrayField).

Parameters:
  • entity (str or int) – An entity being processed.
  • role (str) – A current role.