Function: processUnion()
processUnion(
schema,ctx,field,params):void
Defined in: packages/core/src/processors/union.ts:50
Process z.union() — renders as a Select when all options are literals,
or delegates to processDiscriminatedUnion when a discriminator property is detected.
Falls back to a plain Input for mixed unions.
Parameters
schema
$ZodUnion
The $ZodUnion schema to process.
ctx
The walker context (used by discriminated union delegation).
field
The base FormField to mutate in-place.
params
Parent path metadata for discriminated union child keys.
Returns
void
Remarks
Discriminated unions have def.type === "union" in Zod v4 — they are detected
by the presence of a discriminator property in the def. This processor handles both.