feat: add OpenAPI support

Merged
GG
2y ago
+784-80

it can be accessed by docs/json
UI can be accessed by /api-docs
ARCH-1550
result : https://rocketchat.apidocumentation.com/reference#tag/missing-documentation/POST/api/v1/rooms.cleanHistory

Proposed changes (including videos or screenshots)

Issue(s)

Steps to test or reproduce

Further comments


This pull request introduces a proof of concept for OpenAPI integration into the Rocket.Chat API. It focuses on enhancing type safety, documentation, and validation across various API components. Key changes include:

  • Addition of typed route handling capabilities in api.ts, allowing for OpenAPI-like documentation and validation.
  • Extension of API type definitions in definition.ts with new TypeScript types for improved type safety and error handling.
  • Introduction of an openApi import in index.ts, with noted potential for better code organization and documentation.
  • Minor improvements in type safety, error handling, and documentation in openApi.ts.
  • Refactoring of the custom-sounds.ts API endpoint to include comprehensive response validation using AJV and improved type definitions.
  • Transition of federation.ts API endpoints to use chained get methods, with added AJV schema validation for responses and enhanced type safety.
  • Restructuring of invites.ts API route definitions to use chained methods and inclusion of response validation schemas using AJV for better organization.