object_schema

SchemaAnyOf

class wysdom.SchemaAnyOf(allowed_schemas: Iterable[wysdom.base_schema.Schema.Schema], schema_ref_name: Optional[str] = None)

Bases: wysdom.base_schema.Schema.Schema

A schema requiring a match with any of the permitted schemas supplied.

Parameters:
  • allowed_schemas – A list (or other Iterable) containing the permitted Schema objects.
  • schema_ref_name – An optional unique reference name to use when this schema is referred to by other schemas.
allowed_schemas = None
jsonschema_definition

The underlying jsonschema-compatible schema definition for this schema.

Returns:A jsonschema-compatible dictionary.
referenced_schemas

A dict of named schemas (i.e. schemas with a defined schema_ref_name) that are referenced in this schema, including itself if applicable.

Returns:A dict of Schema objects indexed by their schema_ref_name.
schema_ref_name = None

SchemaArray

class wysdom.SchemaArray(items: Union[Type[CT_co], wysdom.base_schema.Schema.Schema])

Bases: wysdom.base_schema.Schema.Schema

A schema specifying an array (corresponding to a Python list)

Parameters:items – The permitted data type or schema for the items of this array. Must be one of: A primitive Python type (str, int, bool, float) A subclass of UserObject An instance of Schema
items = None
jsonschema_definition

The underlying jsonschema-compatible schema definition for this schema.

Returns:A jsonschema-compatible dictionary.
referenced_schemas

A dict of named schemas (i.e. schemas with a defined schema_ref_name) that are referenced in this schema, including itself if applicable.

Returns:A dict of Schema objects indexed by their schema_ref_name.

SchemaDict

class wysdom.SchemaDict(items: Union[Type[CT_co], wysdom.base_schema.Schema.Schema])

Bases: wysdom.object_schema.SchemaObject.SchemaObject

A schema specifying an object with dynamic properties (corresponding to a Python dict)

Parameters:items – The permitted data type or schema for the properties of this object. Must be one of: A primitive Python type (str, int, bool, float) A subclass of UserObject An instance of Schema

SchemaObject

class wysdom.SchemaObject(properties: Optional[Dict[str, wysdom.base_schema.Schema.Schema]] = None, required: Set[str] = None, additional_properties: Union[bool, wysdom.base_schema.Schema.Schema] = False, object_type: Type[CT_co] = <class 'dict'>, schema_ref_name: Optional[str] = None)

Bases: wysdom.base_schema.SchemaType.SchemaType

A schema specifying an object with named properties.

Parameters:
  • properties – A dictionary of Schema objects defining the expected names and types of this object’s properties.
  • additional_properties – Defines whether this object permits additional dynamically-named properties. Can be True or False, or can be set to a specific Schema to restrict the permitted types of any additional properties.
  • object_type – A custom object type to use when creating object instances from this schema.
  • schema_ref_name – An optional unique reference name to use when this schema is referred to by other schemas.
additional_properties = False
jsonschema_definition

The underlying jsonschema-compatible schema definition for this schema.

Returns:A jsonschema-compatible dictionary.
properties = None
referenced_schemas

A dict of named schemas (i.e. schemas with a defined schema_ref_name) that are referenced in this schema, including itself if applicable.

Returns:A dict of Schema objects indexed by their schema_ref_name.
required = None
schema_ref_name = None
type_name = 'object'

resolve_arg_to_type

wysdom.object_schema.resolve_arg_to_type.resolve_arg_to_schema(arg: Union[Type[CT_co], wysdom.base_schema.Schema.Schema]) → wysdom.base_schema.Schema.Schema

Resolve an argument of heterogeneous type to a Schema instance.

Parameters:arg – Argument to resolve to a Schema. Must be one of: A primitive Python type (str, int, bool, float) A subclass of UserObject An instance of Schema.
Returns:A Schema instance corresponding to the supplied argument.