Repository navigation
feat: output validation and --check mode for CI - #17
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
validate(&Value) -> Vec<Finding>inopenapi-aggregator-core. It is a hand-written semantic validator (pure, no new dependencies, wasm-safe) that checks what an aggregation can actually break: dangling or unbundled$refs, duplicateoperationIds, missingresponses, undeclared, unused or duplicate path parameters, ambiguous paths, unknown security schemes, undeclared tags, invalid component names, and the required document fields. It is not a full OpenAPI JSON Schema validation. Each finding has a severity, a code and a JSON-pointer location, and uncertain rules are warnings.--check: merges, validates and exits non-zero on problems. With-o <file>it also verifies the file is up to date by comparing parsed data, so formatting, YAML vs JSON and key order never count as a difference, and prints a unified diff when it is stale. It never writes and prints nothing to stdout.--deny-warnings(requires--check) also fails on merge, conversion and validation warnings.0passed,1validation errors, denied warnings or a merge/config failure,2output file missing or out of date. If both apply, exit 1 and the diff is still printed. Known caveat, documented: clap usage errors also exit 2.aggregateand shown in the problems panel asvalidationproblems, with the output still visible. The status shows "Merged with validation errors" when relevant.--checkare unchanged.Notes
similaris added to the CLI crate only (for the diff).responseswere fixed, since that is genuinely invalid OpenAPI.$refis skipped for path-parameter checks (covered by a test).Test plan
cargo test --workspace: unit tests for every rule, a no-false-positive suite (Petstore 3.0, Petstore 2.0 after conversion, a 3.1 webhooks-only spec,$refd and path-item-level parameters), and 13 CLI binary tests covering exit codes, diffs, format and key-order independence, missing and unparseable output files, and that check mode never writescargo clippy --workspace --all-targets -- -D warningsandcargo fmt --checkcd web && npm test(78 tests, every playground example validates clean),npm run typecheck,npm run e2e