Skip to content

fix(openapi): recursively walk router stack in OpenAPI spec generation (#1441) - #1508

Open
Awosdot wants to merge 1 commit into
Junirezz:mainfrom
Awosdot:feature/issue-1441-openapi-router-traversal
Open

Awosdot wants to merge 1 commit into
Junirezz:mainfrom
Awosdot:feature/issue-1441-openapi-router-traversal

Conversation

@Awosdot

@Awosdot Awosdot commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

What changed

  • Refactored scripts/generateOpenApi.ts to recursively walk Express Router layers (layer.handle.stack) and flatten nested route mounts[cite: 10].
  • Preserved and concatenated URL path prefixes dynamically when traversing sub-routers (e.g., combining /v1 prefix with sub-route paths like /vaults/:id/rebalance)[cite: 10].
  • Added unit/contract test coverage by mounting a dummy express.Router with a GET /v1/_test route and validating its inclusion in openapi.json post-generation[cite: 10].
  • Regenerated openapi.json and updated snapshot files[cite: 10].

Why

Routes mounted via express.Router without top-level layer.route properties (such as router.use('/v1', v1Router)) were previously omitted during OpenAPI spec generation, preventing SDK validation and leading to undetected API schema drift[cite: 10].

How tested

  • Ran npm test and OpenAPI contract test suites to confirm that /v1/_test and all nested routes render correctly in openapi.json[cite: 10].
  • Verified that all existing OpenAPI contract tests continue to pass cleanly[cite: 10].

Closes

Closes #1441

@drips-wave

drips-wave Bot commented Sep 29, 2026

Copy link
Copy Markdown

@Awosdot Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenAPI spec generation silently drops routes that use express.Router without explicit tag

1 participant