UNPKG

json2zod

Version:

A CLI tool and library to convert JSON to Zod schemas with optional OpenAPI examples.

14 lines (13 loc) 622 B
/** * Generates the complete Zod schema string from the initial input JSON data. * This handles both single objects and arrays of objects at the top level. * * @param inputJson The parsed JSON object or array of objects to base the schema on. * @param options Configuration options. * @param options.addOpenApiExamples A boolean indicating whether to add `.openapi({ example: ... })` calls. * Defaults to `false`. * @returns A string containing the complete TypeScript code for the Zod schema. */ export declare function generateZodSchema(inputJson: any, options?: { addOpenApiExamples?: boolean; }): string;