The schema types that make up this union
Creates a new VineUnionOfTypes instance with the specified schemas.
The schema types that make up this union
Array of schemas to match against input values
The input type of the schema
The output type of the schema
The camelCase output type of the schema
Define a fallback method to invoke when all of the union conditions fail. You may use this method to report an error.
Clones the VineUnionOfTypes schema type.
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.
Transforms into JSONSchema.
Compiles the union of types schema to a compiler node.
Creates conditional branches for each schema using their IS_OF_TYPE methods to determine which schema matches the input value.
The name of the property being validated
Reference store for tracking validators and conditionals
Parser options including camelCase transformation
Vine union of types represents a union data type that automatically determines which schema to apply based on the value's type.
Unlike regular unions that require explicit conditionals, unionOfTypes uses each schema's IS_OF_TYPE method to automatically detect the appropriate schema based on the input value's type.
Example
Example