import { createZod } from "https://deno.land/x/netzo@0.3.91/core/utils/database.utils.ts";
Creates a Zod schema from a JSON schema (string or object).
Examples
const accountJsonSchema = {
type": "object",
"properties": {
"id": { "type": "string" },
"name": { "type": "string" },
},
"required": ["id", "name"]
}
export const accountSchemaString = jsonSchemaToZod(accountJsonSchema);
export const accountSchema = createZodSchema(accountSchemaString);
export type Account = z.infer;
const accountJsonSchema = { type": "object", "properties": { "id": { "type": "string" }, "name": { "type": "string" }, }, "required": ["id", "name"] } export const accountSchemaString = jsonSchemaToZod(accountJsonSchema); export const accountSchema = createZodSchema(accountSchemaString); export type Account = z.infer;