when true, stops validation on the first error, otherwise returns all the errors found. Defaulttrue
-
ValidationOptions.abortEarly
allowUnknown?
boolean
when true, allows object to contain unknown keys which are ignored. Defaultfalse
-
ValidationOptions.allowUnknown
artifacts?
boolean
when true, artifacts are returned alongside the value (i.e. { value, artifacts }) Defaultfalse
ValidationOptions.artifacts
-
cache?
boolean
when true, schema caching is enabled (for schemas with explicit caching rules). Defaultfalse
-
ValidationOptions.cache
context?
ValidationContext
provides an external data set to be used in references
-
ValidationOptions.context
convert?
boolean
when true, attempts to cast values to the required types (e.g. a string to a number). Defaulttrue
-
ValidationOptions.convert
dateFormat?
"string" | "time" | "date" | "iso" | "utc"
sets the string format used when converting dates to strings in error messages and casting. Default'iso'
-
ValidationOptions.dateFormat
debug?
boolean
when true, valid results and throw errors are decorated with a debug property which includes an array of the validation steps used to generate the returned result. Defaultfalse
-
ValidationOptions.debug
errors?
ErrorFormattingOptions
error formatting settings.
-
ValidationOptions.errors
externals?
boolean
if false, the external rules set with any.external() are ignored, which is required to ignore any external validations in synchronous mode (or an exception is thrown). Defaulttrue
-
ValidationOptions.externals
messages?
LanguageMessages
overrides individual error messages. Defaults to no override ({}). Messages use the same rules as templates. Variables in double braces are HTML escaped if the option errors.escapeHtml is set to true. Default{}
-
ValidationOptions.messages
noDefaults?
boolean
when true, do not apply default values. Defaultfalse
-
ValidationOptions.noDefaults
nonEnumerables?
boolean
when true, inputs are shallow cloned to include non-enumerable properties. Defaultfalse
-
ValidationOptions.nonEnumerables
presence?
PresenceMode
sets the default presence requirements. Supported modes: 'optional', 'required', and 'forbidden'. Default'optional'
-
ValidationOptions.presence
skipFunctions?
boolean
when true, ignores unknown keys with a function value. Defaultfalse
remove unknown elements from objects and arrays. - when true, all unknown elements will be removed - when an object: - objects - set to true to remove unknown keys from objects Defaultfalse
-
ValidationOptions.stripUnknown
warnings?
boolean
when true, warnings are returned alongside the value (i.e. { value, warning }). Defaultfalse