The union conditional type extending UnionConditional
Creates a new VineUnion instance with the specified conditionals.
The union conditional type extending UnionConditional
Array of conditional branches to evaluate
The input type of the schema
The output type of the schema
The camelCase output type of the schema
Mark the field under validation as optional. An optional field allows both null and undefined values.
Mark the field under validation to be null. The null value will be written to the output as well.
If optional and nullable are used together, then both undefined
and null values will be allowed.
Define a fallback method to invoke when all of the union conditions fail. You may use this method to report an error.
Transforms into JSONSchema.
Clones the VineUnion schema type.
Compiles the union schema to a compiler node.
The name of the property being validated
Reference store for tracking validators and conditionals
Parser options including camelCase transformation
Vine union represents a union data type. A union is a collection of conditionals and each condition has an associated schema.
Unions allow you to define validation logic where different schemas are applied based on runtime conditions. Each conditional is evaluated in order, and the first matching condition's schema is used for validation.
Example