Skip to main content
@usenarrator/plugin-valibot The Valibot plugin reads schemas the same way the zod plugin does, so a codebase that uses both reads consistently. An object schema lists its fields, and a pipe stacks its checks and transforms in order (“trimmed, an email, at most 255 long”). Validation calls say what happens when the data doesn’t fit.
The plugin declares library: { name: "valibot", versions: ">=1 <2" }. It reads both import * as v from "valibot" and named imports, and only claims calls whose function really comes from valibot, so same-named functions from other libraries are left alone.

Examples

Schemas and pipes
English
Validation
English

What it covers

  • Schemas: strings, numbers, booleans, dates, literals, picklist, enum, object and its strict and loose variants, array, tuple, record, union, variant and object helpers such as pick, omit and partial.
  • Wrappers: optional, nullable, nullish and defaults.
  • Pipes: checks such as email, minLength, maxValue and regex, transforms such as trim, custom messages, and checks forwarded to a field.
  • Validation: parse, safeParse, is, assert, parser and their async variants.
  • describeSchema, so plugins that describe schemas, such as tRPC for procedure inputs, can read Valibot schemas too.

Translating

The English phrasebook is exported as en and typed as ValibotPhrases.