Skip to main content
@usenarrator/plugin-zod The zod plugin reads schema builders as descriptions of data. Base types, objects, arrays, enums, unions, records and literals become types, and modifiers such as .optional(), .min() and .email() become short notes after the type.

Examples

Enums and arrays
English
Modifiers stack in order
English
Objects, unions and records
English

What it covers

  • Base types: string, number, boolean, date, bigint, any, unknown, null.
  • Builders: object, array, enum, nativeEnum, literal, union, record, .extend().
  • Modifiers: optional, nullable, nullish, default, min, max, int, positive, nonnegative, email, url, uuid, refine, transform. describe, meta and openapi are read but don’t add words.
Calls that use a schema, such as Signup.parse(body) and Signup.safeParse(body), are not covered yet and read generically from their names.

Translating

The English phrasebook is exported as zodEn and typed as ZodPhrases. See Translating Narrator.