Changes for version 0.31 - 2026-05-08

  • Enhancements
    • Use Readonly::Values::Boolean for the boolean type — boolean values are now drawn from that module's %booleans hash, giving a consistent and extensible set of recognised truthy/falsy strings across the codebase.
    • Allow 'minimum' as a synonym for 'min' in schema rules.
    • Allow 'regex' as a synonym for 'matches' in schema rules.
  • Bug Fixes
    • Fixed: 'nullable' with a present value triggered "Unknown rule 'nullable'" because the rule-name was handled before the dispatch loop (to set $is_optional) but had no corresponding no-op elsif in the loop itself. The absent-value path was unaffected because the optional block exits with 'next' before the loop runs; only the present-value path was broken.
    • Fixed: nested hashref defaults were not applied when the input hashref was empty ({}). The guard condition checked scalar keys of the original input value rather than of the post-defaults hashref, so an empty input caused the nested validate_strict call to be skipped entirely.
    • Fixed: when an optional parameter had both 'default' and 'schema' set and the parameter was absent, the 'default' value was overwritten by the result of nested schema processing because there was no 'next' after storing the default. The default now wins: a 'next' is inserted immediately after $validated_args{$key} = $rules->{'default'}.
    • Fixed: arrayref fields with a field-schema hash (e.g. schema => { name => { type => 'string' }, age => { type => 'integer' } }) caused "Unknown rule 'name'" because the inner validate_strict call wrapped the element and schema incorrectly, causing field names to be treated as rule names. The handler now distinguishes a field-schema hash (no top-level 'type' key) from a rule hash (has 'type') and calls validate_strict accordingly.
    • Fixed: the 'transform' coderef was invoked twice for every present field — once explicitly before the rule-dispatch loop, and again by the generic "coerce CODE rule-values by calling them" guard inside the loop. The 'optional' coderef had the same double-invocation bug. Both are now added to the exclusion list alongside 'validate', 'callback', and 'validator'.

Documentation

Modules

Validates a set of parameters against a schema