Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/tools / / zodToJsonSchema

Function: zodToJsonSchema()

ts
function zodToJsonSchema(schema, opts?): JsonSchemaRecord;

Defined in: packages/tools/src/schema/to-json-schema.ts:739

Convert a Zod schema instance (v3 classic or v4) to a JSON Schema record. Structural: works across zod copies and never executes user validation code (only default factories and lazy getters, both guarded). Unknown node kinds degrade to permissive {} and are reported via onUnsupported.

Parameters

ParameterType
schemaunknown
optsProjectSchemaOptions

Returns

JsonSchemaRecord

Stable