Description
The roles.list REST API endpoint currently uses the legacy API.v1.addRoute pattern which lacks OpenAPI documentation and AJV response schema validation.
This endpoint should be migrated to the new chained API.v1.get() pattern to enable:
- Automatic OpenAPI/Swagger documentation generation
- AJV response schema validation
- Type inference via
ExtractRoutesFromAPI (eliminating manual typings in rest-typings)
Current Implementation
File: apps/meteor/app/api/server/v1/roles.ts
API.v1.addRoute(
'roles.list',
{ authRequired: true },
{
async get() {
const roles = await Roles.find({}, { projection: { _updatedAt: 0 } }).toArray();
return API.v1.success({ roles });
},
},
);