ata-validator
1.61.3 · 29 Oct 2026MIT21.8k / weekRepositoryHomepagenpmAtom feed
Upgrading ata-validator from 1.52.0 to 1.53.0
1 release in betweenevery note read
Reading releases, release notes and advisories…
Release by release
- new
Custom keywords can ask for their data's context with
dataContext: true: the per-value function is also given{ instancePath, parentData, parentDataProperty, rootData }, as the default validator's keywords are, so it can read or remove the value where it sits. A schema using one runs on the interpreted engine's collecting walk, which knows where every value is; other schemas are untouched.ata-validator/compatgives every keyword this context andit.schemaPath, which is what express-openapi-validator'sreadOnlyandwriteOnlykeywords use to strip read-only properties from a request. - new
ata-validator/compattakes what a library sets up on it in its own code: the formats plugin'saddFormats()is accepted and registers its formats as the reference does, a keyword registered under a list of names is registered under each, and a draft-04 schema (OpenAPI 3.0's meta-schema) is read as draft-07 with itsidas$idand checked against draft-07's meta-schema after its boolean bounds are normalized. A keyword defined only as generated code is now refused when a schema uses it rather than when it is registered, so a library that registers such a keyword for an option it may not use can take the class. With these, express-openapi-validator runs oncompatwith one change of its own (a portablex-eov-type) and validates requests against GitHub's and Stripe's API descriptions, which the default validator cannot load. - new
ata-validator/compatdoes what the reference does while it validates, for the schemas that need it.coerceTypesconverts a value where eachtypeis checked, so it reaches values behindanyOf,oneOf,allOfand$ref;useDefaultsfills defaults behindallOfand$ref; thediscriminatoroption applies theoneOfbranch the tag names; a schema registered under a fragment-only key such as#/components/schemas/Petis found by a$refof that string; a format registered withtype: 'number'is checked on numbers; and custom keywords takebeforeandpostto order keywords that change the data. Errors name the schema a$refpoints to, andoneOfandanyOfwith no passing branch use the reference's wording. express-openapi-validator's own suite, run with ata injected through a small factory option, passes 470 of 470, as it does on the default validator; it passed 429 before these. On 2400 generated documents with composition andcoerceTypes: true, verdicts and coerced data match the reference in every case. A schema keeps its compat copy across compiles, so the work done once per shared schema is not done again: with express-openapi-validator on Stripe's API description, the first request on a second route went from 280 to 200 ms, and the first request overall stays at 1.1 s on both Stripe's and GitHub's. - fixed
A declared property whose value is
undefinedgave different answers on different engines: the generated code skipped it, as the default validator does, and the interpreted engine and the closures used where code generation is blocked checked it and rejected. All of them now skip it. No JSON document carries such a value, but an object about to be serialized often does ({ id: req.params.id }with no such parameter).tests/test_undefined_property.jsholds the engines together.
- new
1 internal line (docs, tests, tooling) left out.