Repository navigation
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
Open
DevScoopee wants to merge 4 commits into
DevScoopee wants to merge 4 commits into
Conversation
|
@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! 🚀 |
… /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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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