Schema
/ API Reference / ConvertersSchema
/ API Reference / ConverterstoZodBoolean
A function that converts a JSON boolean schema to a Zod boolean schema.
The Gist
import { toZodBoolean, T_JSONSchemaBoolean } from '@weser/schema'
const json: T_JSONSchemaBoolean = {
type: 'boolean',
}
const schema = toZodArray(json)
// You can now use the schema as is
schema.safeParse(true)
Parameters
Parameter | Type | Description |
---|---|---|
schema | T_JSONSchemaBoolean | The JSON boolean schema to convert to a Zod boolean schema. |
Returns
(ZodBoolean
) A Zod boolean schema.
© 2024-present Robin Weser. All Rights Reserved.