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

Function arrayProcessor

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

Source from the content-addressed store, hash-verified

274// ==================== COMPOSITE TYPE PROCESSORS ====================
275
276export const arrayProcessor: Processor<schemas.$ZodArray> = (schema, ctx, _json, params) => {
277 const json = _json as JSONSchema.ArraySchema;
278 const def = schema._zod.def as schemas.$ZodArrayDef;
279 const { minimum, maximum } = schema._zod.bag;
280 if (typeof minimum === "number") json.minItems = minimum;
281 if (typeof maximum === "number") json.maxItems = maximum;
282
283 json.type = "array";
284 json.items = process(def.element, ctx as any, {
285 ...params,
286 path: [...params.path, "items"],
287 });
288};
289
290export const objectProcessor: Processor<schemas.$ZodObject> = (schema, ctx, _json, params) => {
291 const json = _json as JSONSchema.ObjectSchema;

Callers

nothing calls this directly

Calls 1

processFunction · 0.90

Tested by

no test coverage detected