Install & Compatibility
Where this runs
tested against v0.23.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.314s · 26.6MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 3.2s · import 1.328s · 27MB
25MB installed
● package 25MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
QuartSchema
✓ from quart_schema import QuartSchema
✗ from quart_schema import QuartSchema as QS
Aliasing not needed, but acceptable. Common mistake: importing from wrong package (e.g., 'quart_schema' vs 'quart_schema.core')
validate_request
✓ from quart_schema import validate_request
✗ from quart_schema.decorators import validate_request
Exposed from top-level package; internal module path may break in future versions.
openapi_spec
✓ from quart_schema import openapi_spec
✗ from quart_schema.openapi import spec
The public symbol is `openapi_spec` at package root.
Minimal Quart app with request body validation using Pydantic model.
from quart import Quart, request, jsonify
from quart_schema import QuartSchema, validate_request
from pydantic import BaseModel
app = Quart(__name__)
QuartSchema(app)
class Item(BaseModel):
name: str
price: float
@app.route('/item', methods=['POST'])
@validate_request(Item)
async def create_item():
data = await request.get_json()
# data is validated as Item
return jsonify({"created": data.name}), 201
if __name__ == '__main__':
app.run()
Errors
Common errors & fixes
pydantic.errors.PydanticUserError: A custom validator cannot be used with `@validate_request` because the model is not instantiated.
Using Pydantic validators that rely on instance state (e.g., `@validator('field', pre=True)`) that expect the model to be instantiated. `@validate_request` only validates JSON payload without model instantiation.
fixUse `@validate_request(SomeModel)` and rely on Pydantic field types; avoid `@validator` that expects instance. If needed, manually instantiate inside the handler.
AttributeError: module 'quart_schema' has no attribute 'QuartSchema'
Older version of quart-schema (<0.14.0) used a different class name or not installed at all.
fixUpgrade to latest: `pip install --upgrade quart-schema`.
TypeError: 'DummyRequest' object is not subscriptable
Trying to access `request.json` or `request.args` directly inside a function decorated with `@validate_request` before calling `await request.get_json()`. The request body is already validated and available as the argument of the function, but raw access may cause issues.
fixRemove manual `request.get_json()`; the validated model is passed as a function argument automatically.
quart.exceptions.BadRequest: 400 Bad Request: JSON decode error
Submitting empty body or invalid JSON. `@validate_request` requires a JSON body.
fixEnsure the client sends a valid JSON payload.
Upgrade
Version history
0.23.0latest on PyPI · released Dec 2, 2025
Audit
Dependencies
quartrequiredRequired web framework
pydanticrequiredSchema definition and validation