api/schemas/ and are used in the service layer to validate incoming data before processing.
Schema structure
Each schema is a marshmallowSchema 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:
error.messages in the ValidationError and pass them to APIException: