{"id":47711238,"url":"https://github.com/ata-core/ata-validator","last_synced_at":"2026-04-08T13:02:24.156Z","repository":{"id":346413953,"uuid":"1188841276","full_name":"ata-core/ata-validator","owner":"ata-core","description":"Ultra-fast JSON Schema validator with full ajv feature parity. 5.9x faster validation, 2,184x faster compilation, Draft 7 + 2020-12. Cross-schema $ref, RE2 regex, simdjson. Standard Schema V1.","archived":false,"fork":false,"pushed_at":"2026-03-31T15:57:58.000Z","size":1630,"stargazers_count":227,"open_issues_count":3,"forks_count":3,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-31T17:48:12.635Z","etag":null,"topics":["fast","json-schema","napi","native","schema","simdjson","standard-schema","validation","validator"],"latest_commit_sha":null,"homepage":"https://ata-validator.com","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ata-core.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-22T16:53:00.000Z","updated_at":"2026-03-31T17:44:48.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/ata-core/ata-validator","commit_stats":null,"previous_names":["ata-core/ata-validator"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/ata-core/ata-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ata-core%2Fata-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ata-core%2Fata-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ata-core%2Fata-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ata-core%2Fata-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ata-core","download_url":"https://codeload.github.com/ata-core/ata-validator/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ata-core%2Fata-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31312917,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fast","json-schema","napi","native","schema","simdjson","standard-schema","validation","validator"],"created_at":"2026-04-02T18:32:26.831Z","updated_at":"2026-04-02T18:32:27.406Z","avatar_url":"https://github.com/ata-core.png","language":"JavaScript","readme":"# ata-validator\n\nUltra-fast JSON Schema validator powered by [simdjson](https://github.com/simdjson/simdjson). Multi-core parallel validation, RE2 regex, codegen bytecode engine. Standard Schema V1 compatible.\n\n**[ata-validator.com](https://ata-validator.com)** | **[API Docs](docs/API.md)** | **[Contributing](CONTRIBUTING.md)**\n\n## Performance\n\n### Simple Schema (7 properties, type + format + range + nested object)\n\n| Scenario | ata | ajv | |\n|---|---|---|---|\n| **validate(obj)** valid | 22ns | 102ns | **ata 4.6x faster** |\n| **validate(obj)** invalid | 87ns | 182ns | **ata 2.1x faster** |\n| **isValidObject(obj)** | 21ns | 100ns | **ata 4.7x faster** |\n| **Schema compilation** | 695ns | 1.30ms | **ata 1,867x faster** |\n| **First validation** | 2.07μs | 1.11ms | **ata 534x faster** |\n\n### Complex Schema (patternProperties + dependentSchemas + propertyNames + additionalProperties)\n\n| Scenario | ata | ajv | |\n|---|---|---|---|\n| **validate(obj)** valid | 17ns | 115ns | **ata 6.8x faster** |\n| **validate(obj)** invalid | 59ns | 194ns | **ata 3.3x faster** |\n| **isValidObject(obj)** | 19ns | 124ns | **ata 6.6x faster** |\n\n### Cross-Schema `$ref` (multi-schema with `$id` registry)\n\n| Scenario | ata | ajv | |\n|---|---|---|---|\n| **validate(obj)** valid | 17ns | 25ns | **ata 1.5x faster** |\n| **validate(obj)** invalid | 34ns | 54ns | **ata 1.6x faster** |\n\n\u003e Measured with [mitata](https://github.com/evanwashere/mitata) on Apple M4 Pro (process-isolated). [Benchmark code](benchmark/bench_complex_mitata.mjs)\n\n### unevaluatedProperties / unevaluatedItems\n\n| Scenario | ata | ajv | |\n|---|---|---|---|\n| **Tier 1** (properties only) valid | 3.3ns | 8.7ns | **ata 2.6x faster** |\n| **Tier 1** invalid | 3.7ns | 19.1ns | **ata 5.2x faster** |\n| **Tier 2** (allOf) valid | 3.3ns | 9.9ns | **ata 3.0x faster** |\n| **Tier 3** (anyOf) valid | 6.7ns | 23.2ns | **ata 3.5x faster** |\n| **Tier 3** invalid | 7.1ns | 42.4ns | **ata 6.0x faster** |\n| **unevaluatedItems** valid | 1.0ns | 5.5ns | **ata 5.4x faster** |\n| **unevaluatedItems** invalid | 0.96ns | 14.2ns | **ata 14.8x faster** |\n| **Compilation** | 375ns | 2.59ms | **ata 6,904x faster** |\n\nThree-tier hybrid codegen: static schemas compile to zero-overhead key checks, dynamic schemas (anyOf/oneOf) use bitmask tracking with V8-inlined branch functions. [Benchmark code](benchmark/bench_unevaluated_mitata.mjs)\n\n### vs Ecosystem (Zod, Valibot, TypeBox)\n\n| Scenario | ata | ajv | typebox | zod | valibot |\n|---|---|---|---|---|---|\n| **validate (valid)** | **9ns** | 38ns | 50ns | 334ns | 326ns |\n| **validate (invalid)** | **37ns** | 103ns | 4ns | 11.8μs | 842ns |\n| **compilation** | **584ns** | 1.20ms | 52μs | — | — |\n| **first validation** | **2.1μs** | 1.11ms | 54μs | — | — |\n\n\u003e Different categories: ata/ajv/typebox are JSON Schema validators, zod/valibot are schema-builder DSLs. [Benchmark code](benchmark/bench_all_mitata.mjs)\n\n### Large Data - JS Object Validation\n\n| Size | ata | ajv | |\n|---|---|---|---|\n| 10 users (2KB) | 6.2M ops/sec | 2.5M ops/sec | **ata 2.5x faster** |\n| 100 users (20KB) | 658K ops/sec | 243K ops/sec | **ata 2.7x faster** |\n| 1,000 users (205KB) | 64K ops/sec | 23.5K ops/sec | **ata 2.7x faster** |\n\n### Real-World Scenarios\n\n| Scenario | ata | ajv | |\n|---|---|---|---|\n| **Serverless cold start** (50 schemas) | 0.1ms | 23ms | **ata 230x faster** |\n| **ReDoS protection** (`^(a+)+$`) | 0.3ms | 765ms | **ata immune (RE2)** |\n| **Batch NDJSON** (10K items, multi-core) | 13.4M/sec | 5.1M/sec | **ata 2.6x faster** |\n| **Fastify startup** (5 routes) | 0.5ms | 6.0ms | **ata 12x faster** |\n\n\u003e Isolated single-schema benchmarks. Results vary by workload and hardware.\n\n### How it works\n\n**Combined single-pass validator**: ata compiles schemas into a single function that validates and collects errors in one pass. Valid data returns `VALID_RESULT` with zero allocation. Invalid data collects errors inline with pre-allocated frozen error objects - no double validation, no try/catch (3.3x V8 deopt). Lazy compilation defers all work to first usage - constructor is near-zero cost.\n\n**JS codegen**: Schemas are compiled to monolithic JS functions (like ajv). Full keyword support including `patternProperties`, `dependentSchemas`, `propertyNames`, `unevaluatedProperties`, `unevaluatedItems`, cross-schema `$ref` with `$id` registry, and Draft 7 auto-detection. Three-tier hybrid approach for unevaluated keywords: compile-time resolution for static schemas, bitmask tracking for dynamic ones. charCodeAt prefix matching replaces regex for simple patterns (4x faster). Merged key iteration loops (patternProperties + propertyNames + additionalProperties in a single `for..in`).\n\n**V8 TurboFan optimizations**: Destructuring batch reads, `undefined` checks instead of `in` operator, context-aware type guard elimination, property hoisting to local variables, tiered uniqueItems (nested loop for small arrays), inline key comparison for small property sets (no Set.has overhead).\n\n**Adaptive simdjson**: For large documents (\u003e8KB) with selective schemas, simdjson On Demand seeks only the needed fields - skipping irrelevant data at GB/s speeds.\n\n### JSON Schema Test Suite\n\n**96.9%** pass rate (1109/1144) on official [JSON Schema Test Suite](https://github.com/json-schema-org/JSON-Schema-Test-Suite) (Draft 2020-12).\n\n## When to use ata\n\n- **High-throughput `validate(obj)`** - 6.8x faster than ajv on complex schemas, 38x faster than zod\n- **Complex schemas** - `patternProperties`, `dependentSchemas`, `propertyNames`, `unevaluatedProperties` all inline JS codegen (6.8x faster than ajv)\n- **Multi-schema projects** - cross-schema `$ref` with `$id` registry, `addSchema()` API\n- **Draft 7 migration** - auto-detects `$schema`, normalizes Draft 7 keywords transparently\n- **Serverless / cold starts** - 6,904x faster compilation, 5,148x faster first validation\n- **Security-sensitive apps** - RE2 regex, immune to ReDoS attacks\n- **Batch/streaming validation** - NDJSON log processing, data pipelines (2.6x faster)\n- **Standard Schema V1** - native support for Fastify v5, tRPC, TanStack\n- **C/C++ embedding** - native library, no JS runtime needed\n\n## When to use ajv\n\n- **100% spec compliance needed** - ajv covers more edge cases (ata: 96.9%)\n- **`$dynamicRef`** - not yet supported in ata\n\n## Features\n\n- **Hybrid validator**: 6.8x faster than ajv valid, 6.0x faster invalid on complex schemas - jsFn boolean guard for valid path (zero allocation), combined codegen with pre-allocated errors for invalid path. Schema compilation cache for repeated schemas\n- **Cross-schema `$ref`**: `schemas` option and `addSchema()` API. Compile-time resolution with `$id` registry, zero runtime overhead\n- **Draft 7 support**: Auto-detects `$schema` field, normalizes `dependencies`/`additionalItems`/`definitions` transparently\n- **Multi-core**: Parallel validation across all CPU cores - 13.4M validations/sec\n- **simdjson**: SIMD-accelerated JSON parsing at GB/s speeds, adaptive On Demand for large docs\n- **RE2 regex**: Linear-time guarantees, immune to ReDoS attacks (2391x faster on pathological input)\n- **V8-optimized codegen**: Destructuring batch reads, type guard elimination, property hoisting\n- **Standard Schema V1**: Compatible with Fastify, tRPC, TanStack, Drizzle\n- **Zero-copy paths**: Buffer and pre-padded input support - no unnecessary copies\n- **Defaults + coercion**: `default` values, `coerceTypes`, `removeAdditional` support\n- **C/C++ library**: Native API for non-Node.js environments\n- **96.9% spec compliant**: Draft 2020-12\n\n## Installation\n\n```bash\nnpm install ata-validator\n```\n\n## Usage\n\n### Node.js\n\n```javascript\nconst { Validator } = require('ata-validator');\n\nconst v = new Validator({\n  type: 'object',\n  properties: {\n    name: { type: 'string', minLength: 1 },\n    email: { type: 'string', format: 'email' },\n    age: { type: 'integer', minimum: 0 },\n    role: { type: 'string', default: 'user' }\n  },\n  required: ['name', 'email']\n});\n\n// Fast boolean check - JS codegen, 15.3M ops/sec\nv.isValidObject({ name: 'Mert', email: 'mert@example.com', age: 26 }); // true\n\n// Full validation with error details + defaults applied\nconst result = v.validate({ name: 'Mert', email: 'mert@example.com' });\n// result.valid === true, data.role === 'user' (default applied)\n\n// JSON string validation (simdjson fast path)\nv.validateJSON('{\"name\": \"Mert\", \"email\": \"mert@example.com\"}');\nv.isValidJSON('{\"name\": \"Mert\", \"email\": \"mert@example.com\"}'); // true\n\n// Buffer input (zero-copy, raw NAPI)\nv.isValid(Buffer.from('{\"name\": \"Mert\", \"email\": \"mert@example.com\"}'));\n\n// Parallel batch - multi-core, NDJSON, 13.4M items/sec\nconst ndjson = Buffer.from(lines.join('\\n'));\nv.isValidParallel(ndjson);  // bool[]\nv.countValid(ndjson);        // number\n```\n\n### Cross-Schema `$ref`\n\n```javascript\nconst addressSchema = {\n  $id: 'https://example.com/address',\n  type: 'object',\n  properties: { street: { type: 'string' }, city: { type: 'string' } },\n  required: ['street', 'city']\n};\n\nconst v = new Validator({\n  type: 'object',\n  properties: {\n    name: { type: 'string' },\n    address: { $ref: 'https://example.com/address' }\n  }\n}, { schemas: [addressSchema] });\n\n// Or use addSchema()\nconst v2 = new Validator(mainSchema);\nv2.addSchema(addressSchema);\n```\n\n### Options\n\n```javascript\nconst v = new Validator(schema, {\n  coerceTypes: true,       // \"42\" → 42 for integer fields\n  removeAdditional: true,  // strip properties not in schema\n  schemas: [otherSchema],  // cross-schema $ref registry\n});\n```\n\n### Standalone Pre-compilation\n\nPre-compile schemas to JS files for near-zero startup. No native addon needed at runtime.\n\n```javascript\nconst fs = require('fs');\n\n// Build phase (once)\nconst v = new Validator(schema);\nfs.writeFileSync('./compiled.js', v.toStandalone());\n\n// Read phase (every startup) - 0.6μs per schema, pure JS\nconst v2 = Validator.fromStandalone(require('./compiled.js'), schema);\n\n// Bundle multiple schemas - deduplicated, single file\nfs.writeFileSync('./bundle.js', Validator.bundleCompact(schemas));\nconst validators = Validator.loadBundle(require('./bundle.js'), schemas);\n```\n\n**Fastify startup (5 routes): ajv 6.0ms → ata 0.5ms (12x faster, no build step needed)**\n\n### Standard Schema V1\n\n```javascript\nconst v = new Validator(schema);\n\n// Works with Fastify, tRPC, TanStack, etc.\nconst result = v['~standard'].validate(data);\n// { value: data } on success\n// { issues: [{ message, path }] } on failure\n```\n\n### Fastify Plugin\n\n```bash\nnpm install fastify-ata\n```\n\n```javascript\nconst fastify = require('fastify')();\nfastify.register(require('fastify-ata'), {\n  coerceTypes: true,\n  removeAdditional: true,\n});\n\n// All existing JSON Schema route definitions work as-is\n```\n\n### C++\n\n```cpp\n#include \"ata.h\"\n\nauto schema = ata::compile(R\"({\n  \"type\": \"object\",\n  \"properties\": { \"name\": {\"type\": \"string\"} },\n  \"required\": [\"name\"]\n})\");\n\nauto result = ata::validate(schema, R\"({\"name\": \"Mert\"})\");\n// result.valid == true\n```\n\n## Supported Keywords\n\n| Category | Keywords |\n|----------|----------|\n| Type | `type` |\n| Numeric | `minimum`, `maximum`, `exclusiveMinimum`, `exclusiveMaximum`, `multipleOf` |\n| String | `minLength`, `maxLength`, `pattern`, `format` |\n| Array | `items`, `prefixItems`, `minItems`, `maxItems`, `uniqueItems`, `contains`, `minContains`, `maxContains`, `unevaluatedItems` |\n| Object | `properties`, `required`, `additionalProperties`, `patternProperties`, `minProperties`, `maxProperties`, `propertyNames`, `dependentRequired`, `dependentSchemas`, `unevaluatedProperties` |\n| Enum/Const | `enum`, `const` |\n| Composition | `allOf`, `anyOf`, `oneOf`, `not` |\n| Conditional | `if`, `then`, `else` |\n| References | `$ref`, `$defs`, `definitions`, `$id` |\n| Boolean | `true`, `false` |\n\n### Format Validators (hand-written, no regex)\n\n`email`, `date`, `date-time`, `time`, `uri`, `uri-reference`, `ipv4`, `ipv6`, `uuid`, `hostname`\n\n## Building from Source\n\n### Development prerequisites\n\nNative builds require C/C++ toolchain support and the following libraries:\n\n- `re2`\n- `abseil`\n- `mimalloc`\n\nInstall them before running `npm install` / `npm run build`:\n\n```bash\n# macOS (Homebrew)\nbrew install re2 abseil mimalloc\n```\n\n```bash\n# Ubuntu/Debian (apt)\nsudo apt-get update\nsudo apt-get install -y libre2-dev libabsl-dev libmimalloc-dev\n```\n\n```bash\n# C++ library + tests\ncmake -B build\ncmake --build build\n./build/ata_tests\n\n# Node.js addon\nnpm install\nnpm run build\nnpm test\n\n# JSON Schema Test Suite\nnpm run test:suite\n```\n\n## License\n\nMIT\n\n## Authors\n\n[Mert Can Altin](https://github.com/mertcanaltin)\n[Daniel Lemire](https://github.com/lemire)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fata-core%2Fata-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fata-core%2Fata-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fata-core%2Fata-validator/lists"}