Skip to content

v0.44.0 — declarative request validation

Choose a tag to compare

@tshafer tshafer released this 11 Jul 15:36
· 114 commits to main since this release

The declarative counterpart to Fastify's route schemas, built on Keel's schema-agnostic validate() engine.

  • validateRequest({ body, query, params }) — middleware that validates the request before the handler runs, rejecting a bad request with a 422 ValidationException. Errors from every part are aggregated into one response, keyed body.field / query.field / params.field, so the handler only ever sees valid input.
  • validated(part) — the parsed, typed value for a request part (default "body"). Coercion (z.coerce.number()) applies before your handler sees the value.

Bring your own Zod-style schema — the framework bundles no validation library.

279 tests; type-checked doc examples. See docs/validation.md.

Also assessed but not added (already covered or a deliberate philosophy call): Errors (createError shipped in 0.41.x), response serialization (covered by Transformers), and Content-Type parsers (Keel keeps body parsing explicit).