UNPKG

prisma-zod-generator

Version:

Prisma 2+ generator to emit Zod schemas from your Prisma schema

22 lines (21 loc) 832 B
/** * JSON validation helper utilities * Exposed for consumers who want to build custom schemas mirroring * the generator's internal depth validation logic. */ /** * Returns a Zod refinement snippet enforcing maximum JSON nesting depth. * The string begins with a leading dot so it can be concatenated onto an * existing base schema (e.g. `z.unknown()` or `z.any()`). * * Example: * const schema = z.unknown() + jsonMaxDepthRefinement(5) * * Note: This mirrors the generator logic (typed recursive helper, empty object guard). */ export declare function jsonMaxDepthRefinement(maxDepth: number): string; /** Compose both structure and depth checks (if you want them together). */ export declare function jsonStructureAndDepthRefinement(options: { maxDepth?: number; enforceSerializable?: boolean; }): string;