Schema
/ API ReferenceSchema
/ API ReferencefromZod
A function that converts a Zod schema to a JSON schema.
For now, it simply uses the toJSONSchema from Zod under the hood.
The Gist
import { fromZod } from '@weser/schema'
const schema = z.object({
name: z.string(),
})
const json = fromZod(schema)
Parameters
Parameter | Type | Description |
---|---|---|
schema | ZodType | The Zod schema to convert to a JSON schema. |
Returns
(T_JSONSchema) A JSON schema.
© 2024-present Robin Weser. All Rights Reserved.