chore: migrate users.getStatus endpoint to new OpenAPI pattern with AJV validation#39482
chore: migrate users.getStatus endpoint to new OpenAPI pattern with AJV validation#39482Yashika-code wants to merge 29 commits intoRocketChat:developfrom
Conversation
- Replace legacy API.v1.addRoute with API.v1.get - Add AJV response validation schema - Export MeEndpoints using ExtractRoutesFromAPI - Extend @rocket.chat/rest-typings Endpoints interface - Enable OpenAPI/Swagger schema generation
Updated /api/v1/me endpoint: removed old @openapi block, added detected AJV schema and TypeScript interface, and cleaned up rest-typings imports.
|
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: f46a7a3 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 |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
WalkthroughThe changes introduce AJV-based validation and OpenAPI schema support for the /api/v1/me and /api/v1/users.getStatus endpoints. Updates include new type definitions (IMeResponse, MeParams), validation schemas, error handlers, and route configurations across the REST API, core typings, and type definitions packages. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
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 7 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="apps/meteor/app/api/server/v1/misc.ts">
<violation number="1" location="apps/meteor/app/api/server/v1/misc.ts:53">
P3: `isMeProps` is defined but never applied to the `/api/v1/me` route (or anywhere else), leaving dead validator code and implying missing query validation. Either wire it via the route options (e.g., `query: isMeProps`) or remove the unused schema.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| }, | ||
| additionalProperties: false, | ||
| }; | ||
| export const isMeProps = ajv.compile<MeParams>(meSchema); |
There was a problem hiding this comment.
P3: isMeProps is defined but never applied to the /api/v1/me route (or anywhere else), leaving dead validator code and implying missing query validation. Either wire it via the route options (e.g., query: isMeProps) or remove the unused schema.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/meteor/app/api/server/v1/misc.ts, line 53:
<comment>`isMeProps` is defined but never applied to the `/api/v1/me` route (or anywhere else), leaving dead validator code and implying missing query validation. Either wire it via the route options (e.g., `query: isMeProps`) or remove the unused schema.</comment>
<file context>
@@ -32,154 +33,75 @@ import { API } from '../api';
+ },
+ additionalProperties: false,
+};
+export const isMeProps = ajv.compile<MeParams>(meSchema);
/**
</file context>
Proposed changes
Migrates the
users.getStatusREST API endpoint from the legacyAPI.v1.addRoutepattern to the new chainedAPI.v1.get()pattern with AJV response schema validation and OpenAPI documentation support.Closes #34983
Endpoints migrated
Architectural changes
API.v1.addRoute('users.getStatus', ...)with the new chained.get('users.getStatus', ...)methodstatus,_id, andconnectionStatusfields401: validateUnauthorizedErrorResponsefor unauthorized access handlingExtractRoutesFromAPI+declare modulefor automatic type inference/v1/users.getStatustyping fromrest-typingsUsersEndpoints(now inferred from API registration via module augmentation)Files changed
apps/meteor/app/api/server/v1/users.ts— Main migrationpackages/rest-typings/src/v1/users.ts— Removed old manual typingRelated project
This continues the REST API migration effort described in the GSoC 2026 project: Replace old REST API definitions over the new API.
cc @diego-sampaio @ggazzo
Summary by CodeRabbit
New Features
Documentation