Array of conditional property sets to evaluate
ObjectGroup instance that can be merged into a VineObject
const schema = vine.object({
account_type: vine.string()
}).merge(
vine.group([
vine.group.if((value) => value.account_type === 'personal', {
first_name: vine.string(),
last_name: vine.string()
}),
vine.group.if((value) => value.account_type === 'business', {
company_name: vine.string(),
tax_id: vine.string()
})
])
)
Wraps object properties inside a conditional statement that evaluates at validation time. Properties are only validated and merged if the condition returns a truthy value.
Callback function that receives the object value and field context
Properties to merge when the condition is truthy
GroupConditional instance for use in vine.group()
Wraps object properties inside an "else" condition that always evaluates to true. Use this as a fallback when no other conditions in the group match.
Properties to merge when no other condition matches
GroupConditional instance that always matches
Creates an object group that conditionally merges properties into an existing object based on runtime validation logic. Groups enable dynamic schema composition where different properties are required based on conditional rules.