restapi.models.schema.PartialSchema

class restapi.models.schema.PartialSchema(strip_required=False, *args, **kwargs)[source]
Parameters:
  • strip_required (bool, default: False)

  • args (Any)

  • kwargs (Any)

__init__(strip_required=False, *args, **kwargs)
Parameters:
  • strip_required (bool, default: False)

  • args (Any)

  • kwargs (Any)

Return type:

None

Methods

__init__([strip_required])

dump(obj, *[, many])

Serialize an object to native Python data types according to this Schema's fields.

dumps(obj, *args[, many])

Same as dump(), except return a JSON-encoded string.

from_dict(fields, *[, name])

Generate a Schema class given a dictionary of fields.

get_attribute(obj, attr, default)

Defines how to pull values from an object to serialize.

handle_error(error, data, *, many, **kwargs)

Custom error handler function for the schema.

load(data, *[, many, partial, unknown])

Deserialize a data structure to an object defined by this Schema's fields.

loads(json_data, *[, many, partial, unknown])

Same as load(), except it takes a JSON string as input.

on_bind_field(field_name, field_obj)

Hook to modify a field when it is bound to the Schema.

raise_get_schema(data, **kwargs)

validate(data, *[, many, partial])

Validate data against the schema, returning a dictionary of validation errors.

Attributes

TYPE_MAPPING

dict_class

error_messages

Overrides for default schema-level error messages

opts

fields

Dictionary mapping field_names -> Field objects