ata-validator 1.17.2 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -51,9 +51,25 @@ if (isValid(req.body)) {
51
51
 
52
52
  The `.compiled.mjs` modules are self-contained: zero runtime dependency on ata-validator, fully tree-shakeable, with TypeScript types emitted alongside.
53
53
 
54
+ ## Measured by others
55
+
56
+ Two public harnesses run ata without ata's involvement. Quote these before anything in this
57
+ file.
58
+
59
+ - [schemabenchmarks.dev](https://schemabenchmarks.dev), a benchmark of runtime validation
60
+ libraries maintained outside this project. On its validation page, valid data, the run of
61
+ 2026-09-13 against ata 1.14.1 puts ata first at 603 ns, with the next entry at 1.77 times
62
+ that. The same site puts ata last on the download page, at 64.9 KB gzipped, because the entry
63
+ it bundles is the runtime compiler; the module `ata build` emits for that schema is 3.9 KB
64
+ minified and gzipped, and a compiled entry for the harness is in preparation.
65
+ - [Bowtie](https://bowtie.report/), the cross-implementation JSON Schema test harness. ata's
66
+ harness runs Draft 2020-12 and draft 7 there; on the harness at ata 1.16.1 the official suite
67
+ passes with nothing failed, errored or skipped under Bowtie's own runner. The v1 dialect is
68
+ declared in a pending harness change that waits for a Bowtie release.
69
+
54
70
  ## Why AOT
55
71
 
56
- | Dimension | Schema | ata-AOT | AJV-runtime | Difference |
72
+ | Dimension | Schema | ata-AOT | runtime validator | Difference |
57
73
  |---|---|---|---|---|
58
74
  | Bundle (gzipped) | simple | 1.0 KB | 52.7 KB | 50.5x smaller |
59
75
  | Bundle (gzipped) | complex | 4.8 KB | 52.7 KB | 11.0x smaller |
@@ -62,8 +78,8 @@ The `.compiled.mjs` modules are self-contained: zero runtime dependency on ata-v
62
78
  | Throughput (1M ops) | simple | 258 Mops/s | 102 Mops/s | 2.5x faster |
63
79
  | Compile time | simple | 8 µs | 1.61 ms | 191x faster |
64
80
 
65
- Reproduce on your machine with `npm run bench:aot-vs-ajv`. Numbers from one run on Apple
66
- M4 Pro, Node 25.2.1, 2026-08-13. Across three runs throughput moved between 258 and 278
81
+ The runtime column is the default validator most frameworks ship. Reproduce on your machine
82
+ with `npm run bench:aot-vs-ajv`. Numbers from one run on Apple M4 Pro, Node 25.2.1, 2026-08-13. Across three runs throughput moved between 258 and 278
67
83
  Mops/s and the compile ratio between 150x and 199x, so treat the last two rows as an order
68
84
  of magnitude rather than a constant.
69
85
 
package/lib/aot-impl.js CHANGED
@@ -202,6 +202,17 @@ function emitClone(node, access, depth) {
202
202
  // An array of primitives has nowhere to hide a key. The reference is
203
203
  // shared with the input, exactly as a shallow strip would leave it.
204
204
  value = read;
205
+ } else if (prop.type === 'array' && prop.items && typeof prop.items === 'object' &&
206
+ !Array.isArray(prop.items) && prop.items.type === 'object' &&
207
+ prop.items.properties) {
208
+ // An array of objects: rebuild each element the same way, so unknown
209
+ // keys inside the array are dropped too. Most real schemas have one of
210
+ // these, and declining them left parse() emitted only for shapes nobody
211
+ // writes.
212
+ const el = '_e' + depth;
213
+ const inner = emitClone(prop.items, el, depth + 1);
214
+ if (!inner) return null;
215
+ value = `${read}.map((${el}) => (${inner}))`;
205
216
  } else {
206
217
  return null;
207
218
  }
package/lib/version.js CHANGED
@@ -7,4 +7,4 @@
7
7
  //
8
8
  // Kept in lockstep with package.json by `tests/test_version_sync.js`.
9
9
 
10
- module.exports = '1.17.2';
10
+ module.exports = '1.18.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ata-validator",
3
- "version": "1.17.2",
3
+ "version": "1.18.0",
4
4
  "description": "JSON Schema validation with first-class TypeScript and zero runtime cost. AOT compile to per-schema ESM modules with zero validator dependency. Generic Validator<T> for TypeBox/Zod/Valibot composition. Optional runtime API. Standard Schema V1 compatible.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -122,13 +122,13 @@
122
122
  "LICENSE"
123
123
  ],
124
124
  "optionalDependencies": {
125
- "@ata-validator/native-darwin-arm64": "1.17.2",
126
- "@ata-validator/native-darwin-x64": "1.17.2",
127
- "@ata-validator/native-linux-arm64-gnu": "1.17.2",
128
- "@ata-validator/native-linux-arm64-musl": "1.17.2",
129
- "@ata-validator/native-linux-x64-gnu": "1.17.2",
130
- "@ata-validator/native-linux-x64-musl": "1.17.2",
131
- "@ata-validator/native-win32-x64": "1.17.2"
125
+ "@ata-validator/native-darwin-arm64": "1.18.0",
126
+ "@ata-validator/native-darwin-x64": "1.18.0",
127
+ "@ata-validator/native-linux-arm64-gnu": "1.18.0",
128
+ "@ata-validator/native-linux-arm64-musl": "1.18.0",
129
+ "@ata-validator/native-linux-x64-gnu": "1.18.0",
130
+ "@ata-validator/native-linux-x64-musl": "1.18.0",
131
+ "@ata-validator/native-win32-x64": "1.18.0"
132
132
  },
133
133
  "peerDependencies": {
134
134
  "yaml": "^2.0.0"