ata-validator
1.61.3 · 29 Oct 2026MIT21.8k / weekRepositoryHomepagenpmAtom feed
Upgrading ata-validator from 1.41.0 to 1.42.0
1 release in betweenevery note read
Reading releases, release notes and advisories…
- 0
- changes to make
- 0
- advisories fixed
- 0
- new
- 4
- fixes
Release by release
- fixed
validateJSON()returned a barefalseinstead of a result for an invalid document when any string in the schema contained the wordfunction, such as a property namedfunction. Code that checksif (!result.valid)behaved correctly, but readingresult.errorsthrew, and a check written asresult.valid === falselet the document through. The generated code is rewritten as text to build that path, and the rewrite read the word inside a string as the start of a function. Strings are now skipped. Affected: 1.23.0 to 1.41.0.validate(),isValidObject()andisValidJSON()were not affected.tests/test_generated_returns_rewrite.jsputs the words and characters that rewrite looks for into property names, enum values and patterns, and checks every entry point against the interpreted engine. - fixed
A
uniqueItemserror named a different duplicate pair depending on the engine that answered. Every engine now reports the first item that has a later equal, and its first later equal (params: { i, j }), as the interpreted engine did. The message for a document checked by generated code can name a different pair than before. - fixed
Generated code and the interpreted engine gave different error lists for the same document in a few shapes; what is accepted did not differ. A value of the wrong type is now also checked against the keywords that apply to its own type (
minimumfor2.5againsttype: "integer",allOfandiffornullagainsttype: "object"), a collapsedoneOforanyOfunder a pattern sorts in schema order, andtypewritten as a one-element array is reported as an array. The SchemaStore sample documents, 31080 of them with mutated copies, now get identical error lists from both engines; three differed before. - fixed
An
isValidObjecttaken before the validator's first call, as inconst check = v.isValidObject, classified the schema again on every call, about ten times the cost of the check. It now hands straight to the compiled check.
- fixed
6 other lines we could not sort, mostly version bumps
- 1.42.0
Once a validator's errors are being read,
validate()withrichErrors: falsedecides and collects in one pass, and withrichErrors: trueeach error is built enriched where it fails rather than plain and enriched afterwards. A validator whose errors are never read is unaffected, and reading only.validstill costs the verdict alone. - 1.42.0
Past its first calls,
validate()is a function generated for the schema rather than shared wrappers around the generated checks. - 1.42.0
oneOfandanyOf(with the collapsedATA4001toATA4003error),additionalPropertiesas a schema, andunevaluatedPropertieswhose evaluated set depends on which branches pass now compile into the function that collects errors. - 1.42.0
A
uniqueItemserror, a collapsedoneOforanyOferror, and aconsterror on an object or array value cost a fraction of what they did. - 1.42.0
More schemas run on generated code instead of the interpreted engine. Every
$refthe interpreted engine can resolve (a pointer deeper than a top-level definition, an$id-relative or absolute URI, a URN, an anchor) is resolved at compile time by that engine's own resolver, andunevaluatedPropertiesthat depends on which branches pass is evaluated at run time in generated code. Of the 980 SchemaStore schemas, 838 compile where 797 did, tsconfig.json and jsconfig.json among them. On the official suite, 326 of 384 Draft 2020-12 groups compile where 305 did, and 238 of 258 draft 7 groups where 219 did. - 1.42.0
Cost of the above: the browser runtime bundle is 108.9 KB gzipped, up from 102.9 KB, and loading the package takes about 0.2 ms longer, both from the larger code generator. Modules from
ata buildare byte for byte the same size. A Fastify app with 10 routes reaches its first validated request 4% sooner.