| 510 | }; |
| 511 | |
| 512 | export 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 | |
| 526 | export const pipeProcessor: Processor<schemas.$ZodPipe> = (schema, ctx, _json, params) => { |
| 527 | const def = schema._zod.def as schemas.$ZodPipeDef; |