Skip to content

deps: add ata JSON Schema validator for node.config.json#62603

Draft
mertcanaltin wants to merge 5 commits intonodejs:mainfrom
mertcanaltin:feat/json-schema-validation
Draft

deps: add ata JSON Schema validator for node.config.json#62603
mertcanaltin wants to merge 5 commits intonodejs:mainfrom
mertcanaltin:feat/json-schema-validation

Conversation

@mertcanaltin
Copy link
Copy Markdown
Member

Adds https://github.com/ata-core/ata-validator (v0.4.3) to validate node.config.json against its JSON Schema before parsing.

This gives users clear error messages when their config file has invalid values or unknown properties, instead of the current generic "Invalid value" errors.

Example output for invalid config:
Invalid configuration in node.config.json: /nodeOptions/import: expected exactly one oneOf match, got 0

What's included:

  • deps/ata/ with ata-validator built using ATA_NO_RE2 (no extra dependencies, only simdjson which is already in core)
  • Schema validation step in node_config_file.cc before existing parsing
  • process.versions.ata

refs: #62598

Add ata-validator (v0.4.3) as a new dependency for JSON Schema
validation. Built with ATA_NO_RE2 to avoid RE2/abseil dependencies.
Uses simdjson (already in core) for JSON parsing.

Refs: nodejs#62598
Validate the configuration file against its JSON Schema using
ata-validator as a supplementary check after the existing parser.
This provides a safety net for type errors the parser might miss.

Refs: nodejs#62598
@nodejs-github-bot
Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/gyp
  • @nodejs/security-wg

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Apr 5, 2026
@mertcanaltin mertcanaltin marked this pull request as draft April 5, 2026 20:03
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 5, 2026

Codecov Report

❌ Patch coverage is 30.00000% with 14 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.70%. Comparing base (12249cc) to head (c28adff).

Files with missing lines Patch % Lines
src/node_config_file.cc 26.31% 10 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62603      +/-   ##
==========================================
- Coverage   91.53%   89.70%   -1.83%     
==========================================
  Files         352      695     +343     
  Lines      147833   214544   +66711     
  Branches    23148    41083   +17935     
==========================================
+ Hits       135321   192466   +57145     
- Misses      12255    14122    +1867     
- Partials      257     7956    +7699     
Files with missing lines Coverage Δ
src/node_metadata.cc 92.85% <100.00%> (ø)
src/node_config_file.cc 76.71% <26.31%> (ø)

... and 461 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@juanarbol
Copy link
Copy Markdown
Member

IMHO this is a bit too much, an extra dep for a schema parser inside Node.js (not to mention that is not even v1.x)

This is not a blocker, this is just my personal opinion

@mertcanaltin
Copy link
Copy Markdown
Member Author

That's a fair concern. The dependency is intentionally minimal, it only uses simdjson which is already in core (no new external dependencies since it's built with ATA_NO_RE2).

On the version, you're right it's pre-1.0, but it already passes 96.9% of the official JSON Schema Test Suite. Happy to work toward 1.0 if that's a requirement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants