API Documentation

Generated Classes

Classes generated using python_jsonschema_objects expose all defined properties as both attributes and through dictionary access.

In addition, classes contain a number of utility methods for serialization, deserialization, and validation.

class python_jsonschema_objects.classbuilder.ProtocolBase(**props)[source]

An instance of a class generated from the provided schema. All properties will be validated according to the definitions provided. However, whether or not all required properties have been provide will not be validated.

Parameters:**props – Properties with which to populate the class object
Returns:The class object populated with values
Raises:validators.ValidationError – If any of the provided properties do not pass validation
as_dict()[source]

Return a dictionary containing the current values of the object.

Returns:The object represented as a dictionary
Return type:(dict)
classmethod from_json(jsonmsg)[source]

Create an object directly from a JSON string.

Applies general validation after creating the object to check whether all required fields are present.

Parameters:jsonmsg (str) – An object encoded as a JSON string
Returns:An object of the generated type
Raises:ValidationError – if jsonmsg does not match the schema cls was generated from
missing_property_names()[source]

Returns a list of properties which are required and missing.

Properties are excluded from this list if they are allowed to be null.

Returns:list of missing properties.
validate()[source]

Applies all defined validation to the current state of the object, and raises an error if they are not all met.

Raises:ValidationError – if validations do not pass