Skip to content

API reference > @kontsedal/olas-zod > ExtraValidators

ExtraValidators type ​

Per-leaf extra validators keyed by dotted path. Match the leaf field's position inside the schema:

  • top-level: 'title' - nested form: 'address.street'

A path names a position in the SCHEMA, not in the value, and an array contributes no segment to it. So a path at or under an array applies to every element:

  • z.array(z.string()) under tags → 'tags' validates each tag - z.array(z.object({ name })) under tags → 'tags.name' validates each item's name field

There is no path that addresses the FieldArray itself. Put an array-level rule, such as "at least three tags" or "no duplicates", in the Zod schema instead: z.array(...).min(3) or z.array(...).refine(fn).createZodForm enforces it, and its message lands in the array'stopLevelErrors.

Validators run alongside zodValidator(schema) — both must pass.

Signature:

typescript
export type ExtraValidators = Record<string, Validator<any>>;

References: Validator

Released under the MIT License.