Skip to main content
BackAnt uses marshmallow for request body validation. Schemas live in api/schemas/ and are used in the service layer to validate incoming data before processing.

Schema structure

Each schema is a marshmallow Schema subclass. The naming convention is Post<Name>Schema for POST request schemas:

Using a schema in a service

validation_error() is a helper in api/helper/functions/validation_error.py that converts a marshmallow ValidationError into an APIException(400) automatically.

Common field types

Field options

Validation example

Nested schemas

Error format

When validation fails, validation_error() raises APIException(400). The response body will be:
For more detailed validation error messages, inspect error.messages in the ValidationError and pass them to APIException: