The schema type being validated
The metadata type passed to validation
Creates a new VineValidator instance with a compiled schema.
The schema to compile for validation
Configuration options for the validator
Whether to convert empty strings to null
OptionalmetaDataValidator?: MetaDataValidatorOptional metadata validator function
Messages provider for error formatting
Error reporter factory function
Reference to static input type for TypeScript inference
Reference to static output type for TypeScript inference
Messages provider instance used for internationalization and custom error message formatting
Error reporter factory function used for formatting and collecting validation errors
Validate data against a schema. Optionally, you can share metaData with the validator
await validator.validate(data)
await validator.validate(data, { meta: {} })
await validator.validate(data, {
meta: { userId: auth.user.id },
errorReporter,
messagesProvider
})
Readonly~standardThe Standard Schema properties.
Performs validation without throwing the validation exception. Instead, the validation errors are returned as the first argument.
await validator.tryValidate(data)
await validator.tryValidate(data, { meta: {} })
await validator.tryValidate(data, {
meta: { userId: auth.user.id },
errorReporter,
messagesProvider
})
Returns the compiled schema and refs as a JSON-serializable object. Useful for caching compiled schemas or debugging validation logic.
Object containing cloned schema and refs
Vine Validator exposes the API to validate data using a pre-compiled schema. This class provides high-performance validation by compiling schemas once and reusing them for multiple validations.
Example