API reference > @kontsedal/olas-zod > rootOnlyZodValidator
rootOnlyZodValidator() function
Run the schema and report only its first **root-level** issue, one with an empty path. Every issue with a path is dropped, on the assumption that each leaf field carries its own validator and reports it there.
For a hand-built createForm whose leaves validate themselves.createZodForm does not use it: it installs a validator that also routes a path-carrying rule, such as .refine(fn, { path: ['confirm'] }) or an array's .min(3), onto the node the path names. Returns null when the schema has no root-level issue.
Signature:
typescript
export declare function rootOnlyZodValidator<T>(schema: z.ZodType<T>): Validator<T>;Parameters
Parameter | Type | Description |
|---|---|---|
schema | z.ZodType<T> |
Returns:
Validator<T>