Repository navigation
feat: add static Arazzo 1.0 and 1.1 validation - #333
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #333 +/- ##
==========================================
+ Coverage 98.27% 98.66% +0.39%
==========================================
Files 80 94 +14
Lines 9481 12284 +2803
==========================================
+ Hits 9317 12120 +2803
Misses 139 139
Partials 25 25
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
daveshanley
left a comment
There was a problem hiding this comment.
Overall
The core of this is good. The normalizer handles merge keys, recursive aliases and big numbers properly without touching the caller's nodes. The prerequisite graph is an iterative DFS. Every expansion is budgeted. The retention test with weak pointers is a nice touch, and the schema snapshots ship with provenance and checksums. That's the hard part, and it's done.
Three things before this merges.
Coverage. 77% on the package and 68% on the patch drops the module from 98% to 91%. This repo runs at 100% and the rule is simple: if a line can't be hit, it doesn't ship. Eight functions sit at 0%: inputSchemaFindings, ecmaPattern.String and MatchString, denyLoader.Load, externalResourceError.Error, inputResourceUnavailable.Error, inputRegexp.String, sourceQualified. Most of those are unreachable defensive branches (details inline), so most of this is deletion.
Duplicated work. Inline parameter expressions are recorded twice. The 2020-12 metaschema is validated against inputs twice (the official schema already does it) and compiled fresh on every call. The subschema keyword walk is copy-pasted three times. checkDependencyGraph has an inline twin in validate(). The semantic test helper runs a pipeline production never runs. Each is small. Together they make the package harder to trust than it deserves to be.
Docs. VALIDATION.md is a snapshot of one local run and belongs in the PR description, where it can't rot. README.md needs rewriting for a human: what it does, one example, what Complete means, what it won't do. Half a page.
The design choices are right: static only, no I/O without a resolver, detached results, explicit coverage records. Fix the above and this is a good package.
|
Addressed the overall review and all 14 inline threads. Each thread has an evidence reply and is resolved. Final head:
Two qualified points are explained in their threads: an input reference into malformed annotation data could reach the compiler-error site, so that behavior retains a public regression; deliberate schema-invalid/cancellation/limit unit tests still need direct internal boundaries. Required adapter methods and deny-load behavior remain and have meaningful boundary tests. Independent review verified the repairs and the final dead-guard cleanup. No open findings remain in the reviewed scopes. |
Problem
Consumers need static Arazzo 1.0/1.1 validation with useful source locations and clear evidence when linked checks cannot run. The existing OpenAPI and HTTP APIs do not provide this.
Solution
Add
arazzo.Validatefor existing nodes andarazzo.ValidateBytesfor exactly one YAML/JSON document. Return detached diagnostics, typed tool errors and check records. Every error returns a non-nil incomplete result. Callers check the error,Valid()andComplete.What changes
arazzo/REQUIREMENTS.md.Existing OpenAPI/HTTP behavior, dependencies, coverage configuration and thresholds are unchanged. Vacuum integration is separate.
Risk
High: this adds a public validation boundary with substantial semantic and source-resolution logic. A defect can accept an invalid document or reject a valid one. Detached results, resource limits, regression tests and independent review cover the new boundary.
Completedescribes implemented static checks, not workflow execution. XPath, legacy JSONPath, runtime-substituted conditions, missing sources and partial adapters produce explicit incomplete check records. External input schemas are not retrieved.Verification and rollout
Local verification on the published code, using Go 1.26.8 with
GOWORK=off:go mod tidy -diffpass.BenchmarkValidateInputsuses a supplied OpenAPI source and a closed workflow input schema. Three local samples before/after removal of duplicated validation work: median 633,243 ns/op → 69,336 ns/op, 582,025 → 85,951 B/op, and 7,540 → 1,104 allocs/op. These are fixture measurements, not a production latency claim.Hosted verification on
d80b603cbfad6ce75ec8d507205a34a7393814c3:See hosted checks and Codecov.
Rollout: consumers opt into the package after release; no migration or environment change. Revert the new package to remove the feature. Workflow execution and Vacuum integration remain separate work.