ata-validator
1.61.3 · 29 Oct 2026MIT21.8k / weekRepositoryHomepagenpmAtom feed
1.61.3 is the newest release of 1.x.
Release note
removeAdditional now strips every level. It removed unknown keys from the root object and stopped there, while the interpreted path recursed, so the same schema and the same document produced opposite verdicts depending only on whether the runtime allowed code generation. A nested request body that Fastify's default validator accepts was rejected. Both paths now strip everywhere the schema describes, and a test compares them.
Standalone modules can emit parse(). Pass { parse: true } to toStandaloneModule and the module also exports a function that validates and returns a copy of the input holding only the properties the schema declares. It reads the keys the schema names rather than enumerating the input and deleting what does not belong, so it costs the schema's size instead of the document's, and it leaves the caller's object untouched. Measured at 5.2x the delete-based strip on a seven-field object with one nested level.
It is emitted only where the copy is provably exact. A $ref, a composition, patternProperties, an additionalProperties schema or an array of objects all leave the allowed key set outside this node's knowledge, and those schemas get no parse() rather than a sanitiser that quietly drops something the schema allows. Off by default, so emitted modules keep their current size.