A validation rule combines a validator function with metadata needed for compilation and execution. This is the building block of all validation logic in Vine.
Think of this type as "Validator" + "metadata"
const minLengthRule: ValidationRule<{ length: number }> = { validator: minLengthValidator, name: 'minLength', isAsync: false, implicit: false} Copy
const minLengthRule: ValidationRule<{ length: number }> = { validator: minLengthValidator, name: 'minLength', isAsync: false, implicit: false}
The type of options the validator accepts
The validation function to execute
Unique name for the validation rule
Whether the validator returns a Promise
Whether the rule runs even when the field value is undefined/null
A validation rule combines a validator function with metadata needed for compilation and execution. This is the building block of all validation logic in Vine.
Think of this type as "Validator" + "metadata"
Example