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:
- A
variable
resolves to an integer but aBaseField
expected; - All choices of
OneOfField
are variables and all resolve toNone
.
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.
- A
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.
- entity (subclass of
-
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.
- entity (instance of
-
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 isproperties
of aDictField
or0
if the current attribute isitems
of aArrayField
).Parameters: - entity (str or int) – An entity being processed.
- role (str) – A current role.