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

Function catchProcessor

packages/zod/src/v4/core/json-schema-processors.ts:512–524  ·  view source on GitHub ↗
(schema, ctx, json, params)

Source from the content-addressed store, hash-verified

510};
511
512export const catchProcessor: Processor<schemas.$ZodCatch> = (schema, ctx, json, params) => {
513 const def = schema._zod.def as schemas.$ZodCatchDef;
514 process(def.innerType, ctx as any, params);
515 const seen = ctx.seen.get(schema)!;
516 seen.ref = def.innerType;
517 let catchValue: any;
518 try {
519 catchValue = def.catchValue(undefined as any);
520 } catch {
521 throw new Error("Dynamic catch values are not supported in JSON Schema");
522 }
523 json.default = catchValue;
524};
525
526export const pipeProcessor: Processor<schemas.$ZodPipe> = (schema, ctx, _json, params) => {
527 const def = schema._zod.def as schemas.$ZodPipeDef;

Callers

nothing calls this directly

Calls 2

processFunction · 0.90
getMethod · 0.80

Tested by

no test coverage detected