validate(schema, mutable, raw_data=None, trusted_data=None, partial=False, strict=False, convert=True, context=None, **kwargs)

Validate some untrusted data using a model. Trusted data can be passed in the trusted_data parameter.

  • schema – The Schema to use as source for validation.
  • mutable – A mapping or instance that can be changed during validation by Schema functions.
  • raw_data – A mapping or instance containing new data to be validated.
  • partial – Allow partial data to validate; useful for PATCH requests. Essentially drops the required=True arguments from field definitions. Default: False
  • strict – Complain about unrecognized keys. Default: False
  • trusted_data – A dict-like structure that may contain already validated data.
  • convert – Controls whether to perform import conversion before validating. Can be turned off to skip an unnecessary conversion step if all values are known to have the right datatypes (e.g., when validating immediately after the initial import). Default: True

data dict containing the valid raw_data plus trusted_data. If errors are found, they are raised as a ValidationError with a list of errors attached.


To learn more about how Validation is used, visit Using Validation