Merged
Conversation
|
@nafiuishaaq 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! 🚀 |
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.
Implemented API versioning for the Nest backend with URL, header, and query negotiation, default-to-latest behavior, deprecation/sunset handling, and version-aware puzzle controllers.
The core wiring lives in main.ts (line 16) and app.module.ts (line 95). I added a version registry plus negotiation middleware/interceptor in api-version.middleware.ts (line 16), api-version.service.ts (line 11), and api-version.interceptor.ts (line 10). That gives us:
/api/v1/puzzles and /api/v2/puzzles
X-API-Version and ?api_version=... fallback negotiation
defaulting unversioned /api/puzzles to the latest active version
X-API-Version, X-API-Latest-Version, X-API-Version-Status, deprecation warnings, Sunset, and upgrade Link headers
410 Gone for removed/sunset versions with upgrade guidance
I split puzzles into explicit v1/v2 handlers in puzzles-v1.controller.ts (line 13) and puzzles-v2.controller.ts (line 25). v2 now demonstrates version-specific validation and business logic by using pageSize instead of limit, capping it, and returning a new response envelope. I also added per-version Swagger setup plus docs endpoints/migration guides in docs.controller.ts (line 49), API_VERSIONING.md, and v1-to-v2.md.
Closes #319