chore: migrate users.setStatus endpoint to new OpenAPI pattern with AJV validation
Closed
YA
6mo ago+113+113+012345678901234567890123456789-91-91-01234567890123456789
Proposed changes
Migrates the users.setStatus REST API endpoint from the legacy API.v1.addRoute pattern to the new chained API.v1.post() pattern with AJV request body and response schema validation and OpenAPI documentation support.
Closes #34983
Endpoints migrated
| Endpoint | Method | Old Pattern | New Pattern |
|---|---|---|---|
users.setStatus | POST | addRoute.post() | .post() chained |
Architectural changes
- Replaced legacy
API.v1.addRoute('users.setStatus', ...)with the new chained.post('users.setStatus', ...)method - Added AJV body schema validation for
status,message,userId,username,userfields - Added
400,401,403error response schemas - Added AJV response schema for 200 response
- Wired up
ExtractRoutesFromAPI+declare modulefor automatic type inference - Removed manual
/v1/users.setStatustyping fromrest-typings(now inferred via module augmentation)
Files changed
apps/meteor/app/api/server/v1/users.ts— Main migrationpackages/rest-typings/src/v1/users.ts— Removed old manual typingapps/meteor/tests/end-to-end/api/users.ts— Updated test assertions to match new AJV error format
Related 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
This PR is part of the ongoing REST API migration effort tracked in RocketChat/Rocket.Chat-Open-API#150
Summary by CodeRabbit
- Improvements
- Enhanced the users.setStatus API endpoint with improved request validation, comprehensive error handling, and better OpenAPI documentation support.
- Added rate limiting to the endpoint for improved stability.
- Consolidated and modernized the endpoint implementation for consistency with the rest of the API.