Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 16x 10x 6x | import { z } from "zod";
import { zodToJsonSchema } from "zod-to-json-schema";
export function toJsonSchema(
schema: z.ZodType<unknown> | Record<string, unknown>
): Record<string, unknown> {
// If it's a Zod schema, convert it
if (schema instanceof z.ZodType) {
return zodToJsonSchema(schema, { target: "openApi3" });
}
// If it's already a JSON schema object, return as is
return schema;
}
|