Skip to content

Feat/versionioning#360

Merged
A6dulmalik merged 2 commits intoMindBlockLabs:mainfrom
nafiuishaaq:feat/versionioning
Mar 26, 2026
Merged

Feat/versionioning#360
A6dulmalik merged 2 commits intoMindBlockLabs:mainfrom
nafiuishaaq:feat/versionioning

Conversation

@nafiuishaaq
Copy link
Copy Markdown
Contributor

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

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 26, 2026

@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! 🚀

Learn more about application limits

@A6dulmalik A6dulmalik merged commit e43b356 into MindBlockLabs:main Mar 26, 2026
3 of 6 checks passed
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.

API Versioning Middleware for Backward Compatibility

2 participants