refactor: migrate livechat/agent.info and livechat/agent.next to OpenAPI chained pattern#39819
Conversation
…API chained pattern
|
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: bfe3fe9 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 |
…API chained pattern
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (2)
📜 Recent review details⏰ 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). (1)
WalkthroughRefactored two Livechat REST API endpoints ( Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested labels
🚥 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 |
|
@ggazzo @cardoso Hi! Could you please review this PR at your convenience? It migrates livechat/agent.info/:rid/:token and livechat/agent.next/:token to the OpenAPI chained pattern as part of the ongoing migration effort tracked in RocketChat/Rocket.Chat-Open-API#150. Thank you! |
ahmed-n-abdeltwab
left a comment
There was a problem hiding this comment.
I noticed some missing steps. Why was the JSON schema moved to rest-typings rather than staying in the route file? Also, you still need to remove the endpoint definitions
|
Hey @ahmed-n-abdeltwab, thanks for the reviewing ! |
PR Description
Migrates the following two legacy
addRouteendpoints to the modern OpenAPI chained.get()pattern with AJV runtime validation:GET livechat/agent.info/:rid/:tokenGET livechat/agent.next/:tokenTracking PR: RocketChat/Rocket.Chat-Open-API#150
Changes Made
apps/meteor/app/livechat/server/api/v1/agent.ts
livechat/agent.info/:rid/:tokenfromAPI.v1.addRoute()→API.v1.get()with response validation (200,400)livechat/agent.next/:tokenfromAPI.v1.addRoute()→API.v1.get()with query (isGETAgentNextToken) and response validation (200,400)ExtractRoutesFromAPIfor both new endpointsdeclare moduleblockpackages/rest-typings/src/v1/omnichannel.ts
GETAgentInfoSuccessResponseAJV validator (agent required,additionalProperties: false)GETAgentNextSuccessResponseAJV validator (agent optional for void return case,additionalProperties: false){ type: 'object' }for agent field to avoid$ref/ Typia unrolling issues in thelivechat/directory@rocket.chat/ddp-clientSDKVerification
Swagger UI
GET /api/v1/livechat/agent.info/:rid/:token181 passing (45s) 81 pending 1 failing 1) LIVECHAT - appearance POST livechat/appearance should update a boolean setting and keep it as boolean: AssertionError: expected true to be falseChecklist
.get()used{ type: 'object' }used for complex types (avoids$refissues inlivechat/)ExtractRoutesFromAPIrest-typings(SDK requires it —ddp-client)MissingRefErroryarn testapi:livechat— all relevant tests passSummary by CodeRabbit