The data structure returned by JSV.validate/3 when validation fails.
Summary
Functions
Wraps the given JSV.Validator.Error list into an JSV.ValidationError
exception.
Drops errors from a validation error, so it is cheaper to copy and to normalize.
Types
@type t() :: %JSV.ValidationError{ __exception__: term(), errors: [JSV.Validator.Error.t()] }
Functions
@spec of([JSV.Validator.Error.t()]) :: t()
Wraps the given JSV.Validator.Error list into an JSV.ValidationError
exception.
Drops errors from a validation error, so it is cheaper to copy and to normalize.
Errors are first filtered by level, then only the errors of the first
:max_errors invalid locations of the data are kept, in data path order.
Without options, the error is returned unchanged.
An invalid location is a data path with errors and no errors deeper in the
data. The errors on the parents of the kept locations are kept too, except the
errors at the JSV.ErrorFormatter.level_intermediary/0 level with a key or
index arg, which only stay when the child location they point at is kept.
The branch errors of anyOf, oneOf, allOf and if are pruned the same
way, and each branch keeps up to :max_errors locations of its own. With
nested branches, the total number of kept locations can be higher than
:max_errors.
Levels are read from the error args. Levels returned by
JSV.Vocabulary.format_error/3 are applied by
JSV.ErrorFormatter.normalize_error/2.
Options
:min_error_level(integer) - Drops the errors whose level is below the given value. When omitted, errors of all levels are kept.:max_errors(positive integer or:infinity) - The number of invalid locations to keep. When omitted or:infinity, all locations are kept.