chore: Add OpenAPI support to chat.delete and chat.react endpoints#39220
chore: Add OpenAPI support to chat.delete and chat.react endpoints#39220sezallagwal wants to merge 6 commits intoRocketChat:developfrom
Conversation
|
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 |
🦋 Changeset detectedLatest commit: 9faecc6 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 |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
WalkthroughMoves global Changes
Sequence Diagram(s)sequenceDiagram
rect rgba(240,240,255,0.5)
participant Client
participant API as API.v1.chat
participant Validator
participant Auth as PermissionCheck
participant DB as MessagesDB
end
Client->>API: POST /v1/chat.delete { msgId, roomId, ... }
API->>Validator: validate request (AJV)
Validator-->>API: validated params
API->>Auth: check permissions (user, room)
Auth-->>API: allowed / denied
API->>DB: fetch message by msgId
DB-->>API: message
API->>DB: perform delete operation
DB-->>API: result
API-->>Client: 200 { _id, ts, message: {...} } or 4xx
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
1 issue found across 3 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="packages/rest-typings/src/v1/chat.ts">
<violation number="1" location="packages/rest-typings/src/v1/chat.ts:1005">
P2: `/v1/chat.delete` was removed from `ChatEndpoints`, but the endpoint is still used in app code and `Endpoints` still depends on `ChatEndpoints`, so type coverage for this REST route is dropped.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
|
Fixed in the latest commit — retained /v1/chat.delete in ChatEndpoints for client-side type coverage. @cubic-dev-ai |
|
Thanks for providing the screenshots! also Once you solve these issues, this PR will be ready |
|
@cubic-dev-ai re-run |
@sezallagwal I have started the AI code review. It will take a few minutes to complete. |
|
I have resolved the issues. Please have a look @ahmed-n-abdeltwab |
ahmed-n-abdeltwab
left a comment
There was a problem hiding this comment.
please take a look at these issues
|
Thanks for the detailed review, @ahmed-n-abdeltwab! I missed the individual thread comments before, but they’re all fixed in the latest commit. |
9547f23 to
692dbfd
Compare
692dbfd to
cc3eb9d
Compare
|
@ahmed-n-abdeltwab I’ve resolved the merge conflicts and verified everything locally using yarn testapi -f '[Chat]'.
|
ahmed-n-abdeltwab
left a comment
There was a problem hiding this comment.
could you take a look at these
|
@ggazzo 👍 |
|
Hey, thanks for the contribution! 🙏 I'm closing this PR because the endpoint(s) covered here have already been migrated as part of a larger batch migration I'm working on (see #39820). I decided to go with a mass migration approach because reviewing individual PRs for each endpoint was taking too much of my time. That said, you're more than welcome to help by reviewing and testing the changes in #39820 to make sure everything is working correctly. Your input would be really valuable! Thanks again for your effort! 🚀 |

Proposed Changes
This PR integrates OpenAPI support into the
Rocket.Chat API, migratingchat.deleteandchat.reactendpoints to the new OpenAPI pattern. The update includes improved API documentation, enhanced type safety, and response validation using AJV.Key Changes:
ExtractRoutesFromAPIutility from the TypeScript definitions to dynamically derive routes from the endpoint specificationsTracked in: RocketChat/Rocket.Chat-Open-API#150
Testing
400validation errorEndpoints
Delete a chat message
POST /api/v1/chat.deleteSend a reaction
POST /api/v1/chat.reactSteps to Test or Reproduce
X-Auth-TokenandX-User-IdPOST /api/v1/chat.deleteand execute with:{ "msgId": "<id>", "roomId": "<rid>" }POST /api/v1/chat.reactand execute with:{ "emoji": ":thumbsup:", "messageId": "<id>" }{}400validation error.Swagger UI —

chat.delete:Swagger UI —

chat.react:Summary by CodeRabbit
New Features
Refactor
Notes