feat: add OpenAPI support
Merged
GG
2y ago+784+784+012345678901234567890123456789-80-80-01234567890123456789
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.tswith new TypeScript types for improved type safety and error handling. - Introduction of an
openApiimport inindex.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.tsAPI endpoint to include comprehensive response validation using AJV and improved type definitions. - Transition of
federation.tsAPI endpoints to use chained get methods, with added AJV schema validation for responses and enhanced type safety. - Restructuring of
invites.tsAPI route definitions to use chained methods and inclusion of response validation schemas using AJV for better organization.