Catmandu::Fix::validate - validate data and keep errors
Contents
Configuration
error_field
Path where to store errors. Set to "errors" by default.
Additional options are passed to the validator.
Description
This Catmandu::Fix validates data with a Catmandu::Validator and stores errors in field "errors" for
further inspection.
Name
Catmandu::Fix::validate - validate data and keep errors
See Also
Catmandu::Fix::Condition::valid
perl v5.40.0 2025-01-17 Catmandu::Fix::validate(3pm)
Synopsis
# Check author field against a JSON Schema
validate('author', JSONSchema, schema: 'my/schema.json')
if exists(errors)
... # do something
end
# Check item against a custom validator, store in errors in 'warnings'
validate('author', MyValidatorClass, error_field: warnings)
