This app validates a manually maintained OpenAPI 3 spec against production APIs using Cloudflare Workers + Workflows + D1 + R2.
- Fetches remote manual OpenAPI via POST using API-key secret.
- Runs static OpenAPI quality checks.
- Executes scenario-based endpoint workflows with dependency context.
- Compares live production behavior against documented contract.
- Classifies issues and stores markdown reports in R2.
- Persists every run and step in D1.
- Exposes dashboard + CSV export.
- Worker (Hono): API + asset serving (
src/worker). - Workflow executor module: run lifecycle (
src/lib/workflow/validationWorkflow.ts). - D1: runs, scenarios, steps, issues, events.
- R2: summary + per-step issue markdown + artifacts.
- UI: lightweight polling dashboard (
src/ui).
- D1 binding:
DB - R2 binding:
ARTIFACTS - Assets binding:
ASSETS - Optional workflow binding:
VALIDATION_WORKFLOW - Secrets/vars:
SPEC_POST_URLSPEC_API_KEY(secret)SPEC_API_KEY_HEADER(optional, defaultx-api-key)SPEC_AUTH_HEADER(optional)SPEC_POST_HEADERS(optional JSON)SPEC_POST_BODY(optional JSON string)SPEC_RESPONSE_PATH(optional dot-path)TARGET_API_BASE_URL
Define explicit scenarios in src/lib/scenarios/loadScenarios.ts. Steps support:
dependsOnrequestBindingsfrom context into body/path/query/headerresponseExtractionsfrom body/headers into context- execution modes including dependency + fixture classes
- POST
/api/runscreates run in D1. - Worker launches async validation execution.
- Fetch + parse + validate spec.
- Run scenarios in dependency order, extracting/binding context.
- Persist step issues + scores.
- Write issue markdown and summary markdown to R2.
- Dashboard polls
/api/runs/:id/progress.
POST /api/runsGET /api/runsGET /api/runs/:idGET /api/runs/:id/progressGET /api/runs/:id/resultsGET /api/runs/:id/reportGET /api/runs/:id/issues/:issueKeyGET /api/runs/:id/export.csv
- Manual Spec Trustworthiness (static + live penalties)
- Production OpenAPI 3 Compatibility (contract fitness)
- Live Verified Coverage (live-tested ratio penalized by blocked/fixture/skipped)
- Generation readiness (
READY,READY_WITH_FIXES,NOT_READY)
- Install deps:
npm install - Apply migration:
wrangler d1 execute openapi_contract_runs --file migrations/0001_init.sql - Set secrets/vars in Wrangler config/dashboard.
- Run:
npm run dev - Deploy:
wrangler deploy
- Scenario definitions are explicit and code-configured.
- Live validation currently checks status/content-type/JSON parse and can be extended for deep schema validation.
- UI is intentionally minimal and polling-based.
A GitHub Actions workflow is included at .github/workflows/deploy.yml.
- Automatic on push to
main - Manual via
workflow_dispatch
CLOUDFLARE_API_TOKENCLOUDFLARE_ACCOUNT_IDSPEC_POST_URLSPEC_API_KEYSPEC_AUTH_HEADER(optional if you use auth header mode)
TARGET_API_BASE_URLSPEC_API_KEY_HEADER(optional)SPEC_POST_HEADERS(optional JSON)SPEC_POST_BODY(optional JSON string)SPEC_RESPONSE_PATH(optional dot path)
The workflow runs npm ci, npm test, and npx wrangler deploy, so deployment does not depend on local machine tooling.