Skip to content

core: generate OpenAPI/Swagger docs for all endpoints#43

Merged
EmeditWeb merged 2 commits into
StepFi-app:mainfrom
pixels26:generate-OpenAPI/Swagger
Jun 16, 2026
Merged

core: generate OpenAPI/Swagger docs for all endpoints#43
EmeditWeb merged 2 commits into
StepFi-app:mainfrom
pixels26:generate-OpenAPI/Swagger

Conversation

@pixels26

Copy link
Copy Markdown
Contributor

Summary

Adds OpenAPI 3.0 documentation with interactive Swagger UI for all API endpoints, auto-generated from NestJS decorators.

Changes

Configuration

  • src/config/swagger.ts — Enhanced Swagger setup: reads version from package.json, adds all 12 API tags with descriptions, JWT Bearer + X-API-Key auth schemes, configurable via SWAGGER_ENABLED env var
  • src/main.ts — Production basic auth guard for docs routes using DOCS_USERNAME/DOCS_PASSWORD env vars

Controller decorators

  • src/modules/reputation/reputation.controller.ts — Added @UseGuards(JwtAuthGuard), @ApiBearerAuth(), @ApiParam, typed @ApiResponse with ReputationResponseDto; fixed missing auth guard on GET /me
  • src/modules/learners/learners.controller.ts — Added @ApiBody({ type: UpdateLearnerProfileDto }) on PATCH endpoint
  • src/modules/auth/auth.controller.ts — Added @ApiBody schema for POST /refresh raw parameter

New utilities

  • src/common/dto/paginated-response.dto.ts — Reusable PaginationMetaDto and PaginatedResponseDto<T>
  • src/common/decorators/api-paginated.decorator.ts@ApiPaginatedResponse(Model) decorator for paginated endpoints

Routes

  • GET /api/v1/docs — Interactive Swagger UI
  • GET /api/v1/docs-json — Raw OpenAPI 3.0 spec
  • Production: gated behind Basic auth when DOCS_USERNAME/DOCS_PASSWORD are set
  • Set SWAGGER_ENABLED=false to disable entirely

Closes #39

@EmeditWeb EmeditWeb merged commit caffc9a into StepFi-app:main Jun 16, 2026
1 check 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.

core: generate OpenAPI/Swagger docs for all endpoints

2 participants