Skip to content

Instantly share code, notes, and snippets.

@Maxiviper117
Created August 12, 2025 17:19
Show Gist options
  • Save Maxiviper117/9915713c36b7353de550595d16d73e57 to your computer and use it in GitHub Desktop.
Save Maxiviper117/9915713c36b7353de550595d16d73e57 to your computer and use it in GitHub Desktop.
Zod V4 Treeify Schema for Flattened Treeify Errors
const TreeifyErrorNode: z.ZodType<any> = z.lazy(() =>
z.object({
errors: z.array(z.string()),
properties: z.record(z.string(), TreeifyErrorNode).optional(),
items: z.array(TreeifyErrorNode.or(z.undefined())).optional(),
})
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment