@sjsf/zod-integration
v1.6.0
Published
The zod based validator augmentation for svelte-jsonschema-form
Downloads
187
Readme
@sjsf/zod-integration
The zod based validator augmentation for svelte-jsonschema-form.
Installation
npm install @sjsf/zod-integration zod zod-to-json-schema
Usage
import { useForm2, type Schema } from '@sjsf/form'
import { createValidator } from "@sjsf/validator-of-your-choice";
import { withZod } from "@sjsf/zod-integration";
import { zodToJsonSchema } from "zod-to-json-schema";
import { z } from "zod";
const schema = z.object({
/* your schema */
});
const validator = withZod(createValidator(), {
schema,
});
const form = useForm2({
schema: zodToJsonSchema(schema) as Schema,
})
License
MIT