Skip to main content

/qa-contract-validate

Validate API contracts through a multi-tool pipeline -- lint, diff, mock, and fuzz.


Overview

Runs a 4-stage validation pipeline against OpenAPI/Swagger specs: Spectral for linting, oasdiff for breaking change detection, Prism for conformance checking, and Schemathesis for fuzz testing. Each tool runs independently based on availability and provided inputs. Gracefully degrades when tools are missing -- reports INCONCLUSIVE rather than false PASS.


Usage

/qa-contract-validate api/openapi.yaml
/qa-contract-validate api/openapi.yaml --baseline api/openapi-v1.yaml
/qa-contract-validate api/openapi.yaml --url http://localhost:3000
ArgumentRequiredDescription
spec pathYesPath to OpenAPI/Swagger YAML or JSON file
--baselineNoBaseline spec for breaking change detection (oasdiff)
--urlNoRunning API URL for conformance and fuzz testing

When run without arguments, launches an interactive wizard.


What It Produces

Files at $JAAN_OUTPUTS_DIR/qa/contract-validate/{id}-{slug}/:

FileContent
{id}-{slug}.mdValidation report with per-tool results and aggregate status
spectral-results.jsonRaw Spectral lint output (if ran)
oasdiff-results.jsonRaw oasdiff output (if ran)
schemathesis-results.jsonRaw Schemathesis output (if ran)

What It Asks

QuestionWhenWhy
Spec pathNo input providedNeed OpenAPI spec to validate
Baseline specNot provided via --baselineOptional, enables breaking change detection
API URLNot provided via --urlOptional, enables live conformance and fuzz testing

Validation Pipeline

StageToolTypeCondition
1. LintSpectralnpmAlways (if installed)
2. Breaking ChangesoasdiffGo binaryBaseline provided + installed
3. ConformancePrismnpmAPI URL provided + installed
4. Fuzz TestingSchemathesisPython pipAPI URL provided + installed

Aggregate status: PASS (all ran, no errors), WARN (warnings only), FAIL (errors/breaking/defects), INCONCLUSIVE (0 tools ran).


Tool Installation

ToolInstall Command
Spectralnpm install -g @stoplight/spectral-cli
oasdiffgo install github.com/tufin/oasdiff@latest or brew install oasdiff
Prismnpm install -g @stoplight/prism-cli
Schemathesispip install schemathesis

The skill checks availability with npx --no-install (npm tools) or version commands. It never auto-installs tools.


Example

Input:

/qa-contract-validate api/openapi.yaml --baseline api/openapi-v1.yaml --url http://localhost:3000

Output:

jaan-to/outputs/qa/contract-validate/01-user-api/
├── 01-user-api.md (validation report)
├── spectral-results.json
├── oasdiff-results.json
└── schemathesis-results.json

Report summary:

Pipeline: 4/4 tools executed
Aggregate: WARN
Spectral: WARN (2 warnings, 0 errors)
oasdiff: PASS (0 breaking changes)
Prism: PASS (0 conformance violations)
Schemathesis: PASS (0 defects in 150 requests)

Tips

  • Run /backend-api-contract first to generate the OpenAPI spec
  • Provide --baseline to catch breaking changes between versions
  • Start your API locally and use --url for live conformance and fuzz testing
  • Add contract validation CI stages via /devops-infra-scaffold


Technical Details

  • Logical Name: qa-contract-validate
  • Command: /qa-contract-validate
  • Role: qa
  • Scope: OpenAPI/Swagger only (v1). GraphQL and gRPC out of scope.
  • Output: $JAAN_OUTPUTS_DIR/qa/contract-validate/{id}-{slug}/
  • Reference: docs/extending/qa-contract-validate-reference.md