nadia.object module

Implementation of schema builder for object type.

class nadia.object.ObjectBuilder(builder_provider)

Bases: nadia.common.Builder

Schema builder for object datatype.

build_schema(spec, **kwargs)

Build Schema from a definition of OpenAPI object.

Parameters:spec (dict) – a mapping containing object definition extracted from OpenAPI spec.
Returns:Schema constructed from spec.
Return type:marshmallow.Schema

Construct Schemas corresponding to object definition.

This method is used to construct attributes of the object schema being constructed.

Parameters:spec (dict) – an OpenAPI object’s definition.
Returns:a mapping property-name -> Schema or Field.
Return type:dict
static create_schema_type(attrs)

Create schema type from given dictionary of attributes.

Parameters:attrs (dict) – mapping of attributes of the newly created Python type.
Returns:newly created type with randomly chosen name and single base class - nadia.NadiaSchema.
Return type:type