Skip to content

Add a schema-drift test asserting openapi.ts matches the actual Express route table #83

Description

@Jagadeeshftw

📌 Description

src/openapi.ts is hand-maintained per the README ("hand-maintained OpenAPI-shaped description"), which means it can silently drift from the real routes registered in createApp() (src/app.ts). openapi.test.ts validates the spec's own shape but not that it actually reflects the live route table.

🧩 Requirements and context

  • Walk the Express app's registered routes (via its internal router stack, or a small introspection helper) and compare method+path pairs against the paths declared in buildOpenApiSpec().
  • Fail the test if a route exists without a spec entry, or a spec entry references a route that no longer exists.
  • Keep the check resilient to path-param syntax differences (:id vs {id}).

🛠️ Suggested execution

  • Add a route-introspection helper (test-only) that lists {method, path} from createApp().
  • Add the comparison test to src/openapi.test.ts.
  • Fix any drift the new test uncovers.

✅ Acceptance criteria

  • Every registered route has a corresponding OpenAPI path entry.
  • Every OpenAPI path entry corresponds to a real route.
  • Test fails loudly on future drift.

🔒 Security notes

Indirectly reduces risk of undocumented/forgotten routes escaping review.

📋 Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

GrantFox OSSGrantFox open-source programMaybe RewardedGrantFox: potentially rewarded contributionOfficial Campaign | FWC26GrantFox official campaign issueapiHTTP/WebSocket APItestingTests and coverage

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions