-
Notifications
You must be signed in to change notification settings - Fork 13k
feat: Add OpenAPI Support to subscriptions.getOne API #37085
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat: Add OpenAPI Support to subscriptions.getOne API #37085
Conversation
🦋 Changeset detectedLatest commit: 8cf6dad The changes in this PR will be included in the next version bump. This PR includes changesets to release 41 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
WalkthroughAdds a new server-side Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Client
participant API as v1/subscriptions.getOne
participant Auth as AuthN/AuthZ
participant AJV as AJV Validator
participant Service as Subscriptions Service
Client->>API: GET /v1/subscriptions.getOne?roomId=...
API->>Auth: verify session/user
alt unauthorized
Auth-->>API: 401
API-->>Client: 401 { success:false, errorType }
else authorized
API->>AJV: validate query (roomId)
alt invalid params
AJV-->>API: 400 { error, errorType }
API-->>Client: 400 { success:false, error, errorType }
else valid
API->>Service: fetch subscription for user by roomId
Service-->>API: subscription | null
API->>AJV: validate 200 response schema
API-->>Client: 200 { success:true, subscription|null }
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #37085 +/- ##
===========================================
- Coverage 67.41% 66.95% -0.47%
===========================================
Files 3288 3122 -166
Lines 111815 109280 -2535
Branches 20421 19824 -597
===========================================
- Hits 75379 73167 -2212
+ Misses 33748 33618 -130
+ Partials 2688 2495 -193
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (4)
.changeset/flat-candles-walk.md(1 hunks)apps/meteor/app/api/server/v1/subscriptions.ts(4 hunks)apps/meteor/tests/end-to-end/api/subscriptions.ts(1 hunks)packages/rest-typings/src/v1/subscriptionsEndpoints.ts(0 hunks)
💤 Files with no reviewable changes (1)
- packages/rest-typings/src/v1/subscriptionsEndpoints.ts
🧰 Additional context used
🧬 Code graph analysis (1)
apps/meteor/app/api/server/v1/subscriptions.ts (4)
packages/core-typings/src/IRoom.ts (1)
IRoom(21-95)packages/rest-typings/src/v1/Ajv.ts (3)
ajv(23-23)validateBadRequestErrorResponse(46-46)validateUnauthorizedErrorResponse(69-69)apps/meteor/app/api/server/ApiClass.ts (1)
ExtractRoutesFromAPI(73-77)packages/rest-typings/src/index.ts (1)
Endpoints(51-98)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
apps/meteor/app/api/server/v1/subscriptions.ts(4 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
apps/meteor/app/api/server/v1/subscriptions.ts (4)
packages/core-typings/src/IRoom.ts (1)
IRoom(21-95)packages/rest-typings/src/v1/Ajv.ts (3)
ajv(23-23)validateBadRequestErrorResponse(46-46)validateUnauthorizedErrorResponse(69-69)apps/meteor/app/api/server/ApiClass.ts (1)
ExtractRoutesFromAPI(73-77)packages/rest-typings/src/index.ts (1)
Endpoints(51-98)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: 📦 Build Packages
- GitHub Check: Builds matrix rust bindings against alpine
- GitHub Check: CodeQL-Build
🔇 Additional comments (4)
apps/meteor/app/api/server/v1/subscriptions.ts (4)
1-16: LGTM! Imports align with the OpenAPI pattern.The new imports support AJV validation, response schemas, and route type extraction, which are all necessary for the OpenAPI integration.
51-65: LGTM! Query validation properly constrains roomId.The
minLength: 1constraint correctly prevents empty strings, and the runtime check has been appropriately removed since the schema now enforces non-empty values. This resolves the previous review discussion.
67-74: LGTM! Endpoint follows the OpenAPI pattern correctly.The endpoint structure is clean:
- Query validation is declarative with the compiled AJV validator
- Pre-compiled error response validators improve performance
- Action function is straightforward with no redundant runtime checks
Also applies to: 199-208
256-261: LGTM! Module augmentation correctly exposes the endpoint types.The type extraction and module augmentation follow the OpenAPI integration pattern, making the
subscriptions.getOneroute types available throughout the codebase.
Description:
This PR integrates OpenAPI support into the
Rocket.Chat API, migrate ofRocket.Chat APIendpoints to the new OpenAPI pattern. The update includes improved API documentation, enhanced type safety, and response validation using AJV.Key Changes:
Issue Reference:
Relates to #34983, part of the ongoing OpenAPI integration effort.
Testing:
Verified that the API response schemas are correctly documented in Swagger UI.
All tests passed without any breaking changes
Endpoints:
Looking forward to your feedback! 🚀
Summary by CodeRabbit
New Features
Documentation
Refactor
Tests