Catman...alidate(3pm)

πŸ“¦
version 1.2025 Β· 4 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– NAME πŸ’–

Catmandu::Fix::validate β€” bestie, this one validates your data and keeps the receipts (aka the 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)

Okay so literally just look at that second one β€” you can yeet your error messages into a field of your choosing, no biggie, we love a customizable queen πŸ‘‘


πŸ¦‹ DESCRIPTION πŸ¦‹

So here's the vibe: this Catmandu::Fix runs your data through a Catmandu::Validator and then β€” and this is the important part, bestie β€” it stores the errors in a field called errors so you can go back and inspect them later. No cap. It doesn't just silently fail on you, it tells you what went wrong and leaves a lil note πŸ’…


πŸŽ€ CONFIGURATION πŸŽ€

  • error_field β€” the path where you wanna stash those errors. Defaults to errors, so if you don't say anything, that's where they're gonna live, periodt.

Also: any extra options you throw at this thing get passed straight through to the validator, so go wild 🫢


🌈 SEE ALSO 🌈

  • Catmandu::Fix::Condition::valid β€” your other fave, go check it out, iykyk πŸ’œ

mwah πŸ’‹ this page is riding with perl v5.40.1, dated 2026-01-24, and it's a Catman...alidate(3pm) moment fr fr β€” go validate something iconic bestie βœ¨πŸ¦‹πŸŒΈ

πŸ“¦ where this page comes from