feat(api): add API versioning, response transforms, and OpenAPI docs#673
Merged
RUKAYAT-CODER merged 2 commits intoMay 27, 2026
Merged
Conversation
- Add API versioning interceptor and module with global response transform - Add global exception filter for standardized error responses - Add OpenAPI spec generation scripts and GitHub Pages deployment workflow - Update controllers to align with versioned API structure - Add flakiness reporter and improve test utilities Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@Vivian-04 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! 🚀 |
Contributor
|
kindly resolve conflict and workflow |
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.
PR #618 Implement automatic API documentation generation
Linked Issue
Closes #618
What does this PR do?
This PR introduces a global
ApiVersionInterceptorthat reads theX-API-Versionheader on every request and rejects unsupported versions before they reach any controller. AResponseTransformInterceptorwraps all successful responses in a consistent{ success, data, correlationId }envelope, and aGlobalExceptionFilternormalises every error into the same predictable shape. On the documentation side,scripts/generate-api-docs.jsgenerates a fully-typed OpenAPI 3.0.3 spec and a self-contained ReDoc site underdocs/site/, which is automatically deployed to GitHub Pages on every push tomainvia the newapi-docs.ymlworkflow. The implementation was chosen to be purely additive through NestJS global interceptors so no controller needed bespoke changes beyond removing hand-rolled{ success: true }wrappers.Type of change
Pre-merge checklist (required)
Branch & metadata
feature/issue-<N>-<slug>/fix/issue-<N>-<slug>conventiondevelopormain)Code quality & tests
npm run lint:ci— zero ESLint warningsnpm run format:check— Prettier reports no changes needednpm run typecheck— zero TypeScript errorsnpm run test:ci— all tests pass, coverage ≥ 70%.spec.tsunit testsError handling & NestJS best practices
class-validator/class-transformerdecorators and are wired through NestJS pipes (e.g. globalValidationPipeor explicit)any/unknownreaching the domain)BadRequestException,UnauthorizedException,ForbiddenException,NotFoundException) instead of genericErrorLoggeror central logger service) with meaningful, structured messagesAuthGuard, role/permissions guards, custom guards) are applied to all new/modified endpoints where appropriateAPI documentation / Swagger
/api(or Swagger UI) reflects new/changed endpoints correctlyBreaking changes
Breaking change description (if applicable)
{ success: true, data: <value>, correlationId: <id> }{ success: false, statusCode, message, path, timestamp, correlationId }X-API-Versionheader"1"); invalid version →400 Bad RequestMigration: Consumers must unwrap
.datafrom all success responses. Consumers that already key onsuccess: truein the response body are unaffected by the success shape change. All clients should begin sendingX-API-Version: 1on every request; omitting the header falls back to the default version ("1") so existing integrations will not break immediately, but relying on the default is discouraged.Test evidence (required)
Commands run locally
Manual / API verification
Screenshots / recordings (if applicable)
Closes #618