Skip to content

Migrate roles.list endpoint to new chained API pattern with OpenAPI support #39193

@NAME-ASHWANIYADAV

Description

@NAME-ASHWANIYADAV

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 });
    },
  },
);

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: featurePull requests that introduces new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions