MCPcopy
hub / github.com/colinhacks/zod / createToJSONSchemaMethod

Function createToJSONSchemaMethod

packages/zod/src/v4/core/to-json-schema.ts:601–607  ·  view source on GitHub ↗
(schema: T, processors: Record<string, Processor> = {})

Source from the content-addressed store, hash-verified

599 */
600export const createToJSONSchemaMethod =
601 <T extends schemas.$ZodType>(schema: T, processors: Record<string, Processor> = {}) =>
602 (params?: ToJSONSchemaParams): ZodStandardJSONSchemaPayload<T> => {
603 const ctx = initializeContext({ ...params, processors });
604 process(schema, ctx);
605 extractDefs(ctx, schema);
606 return finalize(ctx, schema);
607 };
608
609/**
610 * Creates a toJSONSchema method for a schema instance.

Callers 1

schemas.tsFile · 0.90

Calls 4

initializeContextFunction · 0.85
processFunction · 0.85
extractDefsFunction · 0.85
finalizeFunction · 0.85

Tested by

no test coverage detected