---
name: "Catmandu::Fix::validate"
section: "3pm"
platform: "linux"
package: "libcatmandu-perl"
version: "1.2024-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Catmandu::Fix::validate"
---

# Catmandu::Fix::validate(3pm)

validate data and keep errors

## NAME

Catmandu::Fix::validate - validate data and keep errors

## 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)
```

## DESCRIPTION

This Catmandu::Fix validates data with a Catmandu::Validator and stores errors in field `"errors"` for further inspection.

## CONFIGURATION

- error\_field

  Path where to store errors. Set to `"errors"` by default.

Additional options are passed to the validator.

## SEE ALSO

Catmandu::Fix::Condition::valid
