Skip to content

docs(subscriptions): add OpenAPI/Swagger decorators to entity and con… - #1341

Open
pharwasz wants to merge 1 commit into
rinafcode:mainfrom
pharwasz:docs/subscriptions-swagger
Open

docs(subscriptions): add OpenAPI/Swagger decorators to entity and con…#1341
pharwasz wants to merge 1 commit into
rinafcode:mainfrom
pharwasz:docs/subscriptions-swagger

Conversation

@pharwasz

Copy link
Copy Markdown
Contributor

Summary

Adds complete OpenAPI/Swagger documentation to the subscriptions module — entity schema and all controller endpoints — so they render properly in Swagger UI.

Changes

src/payments/entities/subscription.entity.ts

  • Added @ApiProperty / @ApiPropertyOptional decorators to all fields for correct schema generation

src/payments/subscriptions/subscriptions.controller.ts

  • @ApiTags — controller grouped under "Subscriptions"
  • @ApiOperation — summaries added to all 7 endpoints
  • @ApiResponse — documented per endpoint:
    • Success responses typed with the Subscription schema
    • 401 Unauthorized (JWT auth required)
    • 400 Bad Request (validation errors)
    • 404 Not Found (missing resources)
    • 402 Payment Required (upgrade endpoint payment failures)

Verification

⚠️ Swagger UI verification could not be completed in this PR, blocked by:

  1. Pre-existing TypeScript compilation errors — 6 errors across 4 files, unrelated to this change (not introduced by this PR)
  2. Custom docs generator (scripts/generate-api-docs.js) is static and doesn't scan controllers dynamically, so it can't be used to spot-check this either

The decorator syntax and structure follow existing NestJS Swagger conventions used elsewhere in the codebase, so this should render correctly once the app builds — but it has not been visually confirmed in Swagger UI.

Follow-up needed

  • Resolve the 6 pre-existing TS compile errors (separate from this PR's scope)
  • Once building, run the app and confirm /api-docs (or wherever Swagger is mounted) renders the Subscriptions section correctly
  • Regenerate openapi-spec.json / docs/site output and commit separately once verified (kept out of this PR intentionally)

Type of change

  • Documentation
  • Bug fix
  • New feature
  • Breaking change

close #1312

…troller

- Add @ApiProperty/@ApiPropertyOptional to Subscription entity fields
- Add @apitags, @apioperation, @apiresponse to all 7 subscription endpoints
- Document 401/400/404/402 responses
- Regenerate OpenAPI spec and docs site
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@pharwasz 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

@RUKAYAT-CODER

Copy link
Copy Markdown
Contributor

Well done on the job done so far!
Kindly fix workflow to pass

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.

Add OpenAPI/Swagger documentation to subscriptions endpoints

2 participants