Skip to content

Share offline validation of YAML nodes and example schemas - #343

Merged
daveshanley merged 4 commits into
mainfrom
codex/openlint-node-validation
Nov 19, 2026
Merged

daveshanley merged 4 commits into
mainfrom
codex/openlint-node-validation

Conversation

@daveshanley

Copy link
Copy Markdown
Member

Add two entry points for consumers that already have parsed YAML and a JSON Schema. Validate a node against a compiled schema, or compile an example schema for a request or response. Compilation runs offline and the cache is bounded.

Vacuum uses these entry points for its packaged OpenLint rules in daveshanley/vacuum#1065. Tests cover draft selection, nullable fields, request and response requirements, YAML keys and aliases, and cache ownership.

@codecov

codecov Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.77%. Comparing base (0e468fa) to head (9f66d86).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #343      +/-   ##
==========================================
+ Coverage   98.76%   98.77%   +0.01%     
==========================================
  Files          95       96       +1     
  Lines       12430    12580     +150     
==========================================
+ Hits        12276    12426     +150     
  Misses        129      129              
  Partials       25       25              
Flag Coverage Δ
unittests 98.77% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@daveshanley daveshanley left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good bones on this one. The offline loader, the copy-on-write YAML walk and the sync.OnceValues cache are all things I'd want here, and -race is green locally.

But I poked at the edges with a scratch test and found four things that bite. The big one is if: pruning required inside a condition flips which branch fires, so a perfectly valid request example fails. The other three are about where the example path quietly disagrees with the rest of the library (nullable under 3.1, readOnly through allOf, and .inf killing the compile). Inline comments have repros.

None of it is hard to fix. I'd fix if before vacuum#1065 ships, because that one turns into false positives for real users.

Comment thread schema_validation/example_schema.go Resolved
Comment thread schema_validation/example_schema.go Resolved
Comment thread schema_validation/directional_schema.go Resolved
Comment thread schema_validation/example_schema.go Resolved
Comment thread schema_validation/example_schema.go Resolved
Comment thread schema_validation/example_schema.go Resolved
Comment thread schema_validation/example_schema.go Resolved
@daveshanley
daveshanley force-pushed the codex/openlint-node-validation branch from 801ad24 to 9f66d86 Compare November 19, 2026 17:05
@daveshanley
daveshanley marked this pull request as ready for review November 19, 2026 19:48
@daveshanley
daveshanley merged commit 04f51a9 into main Nov 19, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant