Skip to content

This change versions the Lens API by serving every public route under /v1 while keeping the existing unversioned paths as deprecated, behavior-identical aliases. Versioning is handled centrally with a Fastify rewriteUrl hook instead of mounting routes twice, so both forms resolve to the same handler and cannot drift. - #427

Open
DevScoopee wants to merge 4 commits into
Divinity-Labs:mainfrom
DevScoopee:There-is-no-version-in-the-URL

Conversation

@DevScoopee

Copy link
Copy Markdown

The routes previously had no version segment, which made the in-flight response-shape changes impossible to ship without breaking existing callers. To fix this, the /v1 segment is stripped before routing so /v1/price/... and /price/... hit one identical route definition, and requests using the deprecated alias get Deprecation: true and a Link: </v1/...>; rel="successor-version" header pointing at the versioned path. I added path helpers to src/openapi/coverage.ts, wired the rewrite and warning hook in src/app.ts, moved all public paths in openapi.yaml under /v1 (regenerating openapi.json), and extended tests/openapi.test.ts to assert that every documented versioned path maps to a registered alias, that the alias always exists, and that both forms answer identically. I also wrote the warning contract and retirement window in docs/api-versioning.md, updated the README endpoint table, and added a minor changeset. No callers break because the unversioned paths still answer identically

Closes #264

@drips-wave

drips-wave Bot commented Oct 17, 2026

Copy link
Copy Markdown

@DevScoopee 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

DevScoopee and others added 4 commits October 17, 2026 07:26
… /v1 while keeping the existing unversioned paths as deprecated, behavior-identical aliases. Versioning is handled centrally with a Fastify rewriteUrl hook instead of mounting routes twice, so both forms resolve to the same handler and cannot drift.

The routes previously had no version segment, which made the in-flight response-shape changes impossible to ship without breaking existing callers. To fix this, the /v1 segment is stripped before routing so /v1/price/... and /price/... hit one identical route definition, and requests using the deprecated alias get Deprecation: true and a Link: </v1/...>; rel="successor-version" header pointing at the versioned path. I added path helpers to src/openapi/coverage.ts, wired the rewrite and warning hook in src/app.ts, moved all public paths in openapi.yaml under /v1 (regenerating openapi.json), and extended tests/openapi.test.ts to assert that every documented versioned path maps to a registered alias, that the alias always exists, and that both forms answer identically. I also wrote the warning contract and retirement window in docs/api-versioning.md, updated the README endpoint table, and added a minor changeset. No callers break because the unversioned paths still answer identically

Closes Divinity-Labs#264
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.

There is no version in the URL

1 participant