feat: Add OpenAPI Support to Engagement Dashboard API
Description:
This PR integrates OpenAPI support into the Rocket.Chat API, migrate of Rocket.Chat API endpoints to the new OpenAPI pattern. The update includes improved API documentation, enhanced type safety, and response validation using AJV.
Key Changes:
- Implemented the new pattern and added AJV-based JSON schema validation for API.
- Uses the ExtractRoutesFromAPI utility from the TypeScript definitions to dynamically derive the routes from the endpoint specifications.
- Enabled Swagger UI integration for this API.
- This does not introduce any breaking changes to the endpoint logic.
Issue Reference:
Relates to #34983, part of the ongoing OpenAPI integration effort.
Testing: (processing)
- Verified that the API response schemas are correctly documented in Swagger UI.
- All tests passed without any breaking changes
Endpoints: (processing)
- Users Engagement:
Looking forward to your feedback! 🚀
This pull request introduces OpenAPI support to the Engagement Dashboard API within the Rocket.Chat repository. The changes focus on enhancing the API's structure and validation processes. Specifically, the TypeScript types for API responses have been refactored by introducing a new helper type, ResultForStatus, to improve maintainability. Additionally, several API endpoints in the Engagement Dashboard's users section have been updated to utilize the API.v1.get method along with ajv for schema validation of request queries and responses. This transition from the older API.v1.addRoute structure ensures more consistent API contract definitions and validation.