Skip to content

v0.10.0 — request validation

Choose a tag to compare

@tshafer tshafer released this 10 Jul 19:30
· 159 commits to main since this release

validate() — parse request input against a schema, get typed data, and let invalid input become an automatic 422:

const NewUser = z.object({ email: z.string().email(), age: z.number().min(18) });

async store() {
  const data = await validate(NewUser);   // { email: string; age: number }
  return json({ created: data.email }, 201);
}
// invalid body -> 422 { error, status, errors: { email: [...], age: [...] } }

Schema-agnostic (any Zod-style safeParse), so the framework doesn't bundle a validation library — npm install zod in your app. See docs/validation.md.