ata-validator
1.61.3 · 29 Oct 2026MIT21.8k / weekRepositoryHomepagenpmAtom feed
1.61.3 is the newest release of 1.x.
In short
4 fixed
Release note
Fixed
A pattern of the form ^[class]+$, ^[class]{m,n}$ or ^[class]{n}$ with n above 16 could be violated without validate() saying so.
The boolean program compiles those patterns to an inline character loop wrapped in an arrow function. The rewrite that turns the boolean program into the error-reporting one replaced the return false and return true inside that arrow with return E(d) and return R. Both are objects, so the arrow returned a truthy value on mismatch, the enclosing !(cond && obj) went false, and the error program accepted what the boolean program had rejected.
What that looked like depended on the path:
Without preprocessing,
validate()still rejected, because the boolean verdict runs first, but the error was a genericschema validation failedwith no keyword, noparams.patternand no path.With preprocessing, which means any schema carrying a
default, or a validator built withcoerceTypesorremoveAdditional, the error program is installed asvalidate()directly and the result wasvalid: true.Validator.bundleStandaloneandbundleCompactembed the same program and had the same silent accept.ata compileoutput is built from the boolean program and was not affected.
The rewrite has been wrong since 0.6.0. The official suite never exercises these pattern shapes, so nothing caught it. The rewrite now leaves the body of an arrow function alone, the same way it already left function bodies alone.
tests/test_hybrid_agreement.js compares the rewritten program with the boolean it came from on every affected shape, at the root, in a property, in array items, through bundleStandalone and through a compiled module, and checks the two preprocessing cases directly. tests/test_codegen_entrypoint_agreement.js now compares the rewritten program as a fifth participant across the whole official suite. tests/test_ajv_errors.js, which had been failing on exactly this for as long as the bug existed, is now part of npm test.
If you use coerceTypes, removeAdditional, schemas with default values, or bundleStandalone, and your schemas contain patterns of these shapes, update.
Changed
Ranking an error into schema declaration order no longer re-derives the rank on every error of every failing document. The rank is cached per path under its root and each node's keys are indexed once. That function drops from 8.5% to 1.4% of the error path, and the error path as a whole gets 3.5% faster, median of eleven interleaved runs.