chore(rest): migrate /api/v1/users.autocomplete to OpenAPI endpoint definition
Closed
YA
6mo ago+111+111+012345678901234567890123456789-33-33-01234567890123456789
Migrates the users.autocomplete REST API endpoint from the legacy API.v1.addRoute pattern to the new chained API.v1.get() pattern with AJV query and response schema validation and OpenAPI documentation support.
Endpoints migrated
| Endpoint | Method | Old Pattern | New Pattern |
|---|---|---|---|
| users.autocomplete | GET | addRoute | .get() chained |
Architectural changes
- Replaced legacy
API.v1.addRoute('users.autocomplete', ...)with the new chained.get('users.autocomplete', ...)method - Added AJV query schema validation for the
selectorparameter - Added 400 and 401 error response schemas using
validateBadRequestErrorResponseandvalidateUnauthorizedErrorResponse - Added AJV 200 response schema for the returned autocomplete users list
- Ensured strict validation with
additionalProperties: falsein the query schema - Preserved the existing permission checks and selector validation logic using
isValidQuery
Files changed
apps/meteor/app/api/server/v1/users.tsβ Main migrationpackages/rest-typings/src/v1/users.tsβ Removed the old manual TypeScript typing forusers.autocompletesince endpoint types are now derived from the AJV schema.changeset/migrate-users-autocomplete-openapi.mdβ Changeset entry
Related project
This continues the REST API migration effort described in the GSoC 2026 project: Replace old REST API definitions with the new API pattern.
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
- New Features
- Enhanced users.autocomplete REST endpoint with richer, permission-aware results, stricter request/response validation, and preserved routing behavior.
- Documentation
- Added migration guidance and OpenAPI documentation for the users.autocomplete endpoint and its new API pattern.