OptionalnullableWhen true, the field accepts null and becomes optional.
Must be "enum" to indicate an enum field.
A non-empty readonly tuple of allowed string values.
At the type level, values[number] produces the union of allowed string literals.
At runtime, this is passed to z.enum() for validation.
Must contain at least one value (enforced by the [string, ...string[]] tuple type).
A schema field definition for an enum type.
The
valuestuple defines the allowed string literals, used for both TypeScript type inference (values[number]→ string literal union) and Zod runtime validation (z.enum(values)).Enum fields can appear at any nesting level: top-level, inside nested objects, or as array items.
Example