[NOMERGE] feat: openapi migration progress #150
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🚀 OpenAPI Migration Progress
This PR tracks the ongoing progress of migrating
Rocket.Chat API
endpoints to the new OpenAPI pattern with AJV validation and improved documentation. It will be continuously updated to reflect completed and remaining work.✅ Summary
👥 Team
📢 Team Chat: Join our chat
🚨 Core API Endpoints
These are 500 endpoints critical for core features and should be migrated first:
Authentication (0 / 9 completed)
Content Management (0 / 11 completed)
Integrations (7 / 13 completed)
webdav.getMyAccountsfeat: Add OpenAPI Support to Webdav API Rocket.Chat#35884webdav.removeWebdavAccountfeat: Add OpenAPI Support to Webdav API Rocket.Chat#35884oauth-apps.createfeat: Add OpenAPI Support to oauth-apps.create API Rocket.Chat#36507oauth-apps.updatefeat: Add OpenAPI Support to oauth-apps.update API Rocket.Chat#36585oauth-apps.listfeat: Add OpenAPI Support to oauth-apps.list API Rocket.Chat#36586oauth-apps.getfeat: Add OpenAPI Support to oauth-apps.get API Rocket.Chat#36598oauth-apps.deletefeat: Add OpenAPI Support to oauth-apps.delete API Rocket.Chat#36606Marketplace Apps (0 / 4 completed)
Messaging (3 / 39 completed)
chat.pinMessagefeat: Add OpenAPI Support to chat.pinMessage API Rocket.Chat#36020chat.unPinMessagefeat: Add OpenAPI Support to chat.unpinMessage API Rocket.Chat#36668dm.deletefeat: Add OpenAPI Support to dm.delete/im.delete API Rocket.Chat#36677Omnichannel (0 / 154 completed)
Miscellaneous (0 / 24 completed)
Notifications (0 / 6 completed)
Rooms (0 / 126 completed)
Settings (1 / 47 completed)
e2e.setRoomKeyIDfeat: Add OpenAPI Support to e2e.setRoomKeyID API Rocket.Chat#36716Statistics (0 / 15 completed)
User Management (2 / 52 completed)
permissions.listAllfeat: Add OpenAPI Support to Permissions API Rocket.Chat#35985permissions.updatefeat: Add OpenAPI Support to Permissions API Rocket.Chat#35985Let me know if you'd like these grouped, categorized, or documented further.
📝 Secondary API Endpoints
These 2 endpoints are lower priority and can be migrated after core APIs: (calculating...)
Statistics (0 / 1 completed)
User Management (0 / 1 completed)
Notifications (0 / 1 completed)
📌 Important Notes
When migrating endpoints to the new OpenAPI + AJV pattern, keep these points in mind:
No Change in Logic
Error Response Codes
400
(Bad Request) → Should be included for most endpoints with input validation.401
(Unauthorized) → Add only if the endpointauthRequired: true
is included.403
(Forbidden) → Add only if specific permission checks are performed.Schema Validation
$ref
schemas where available instead of manually defining large object shapes.Centralized Error Validators
validateBadRequestErrorResponse
instead of hard-coding error schemas.Route Definition Style
.post()
,.get()
, etc.).ExtractRoutesFromAPI
automatically groups routes under the same path in the type definitions.Optional Properties
permissionsRequired
, omit it.No More
rest-typings
or Manual Typingsrest-typings
or other manual typing files — everything for an endpoint lives in one place for easier maintenance.Swagger Documentation
📖 Example: Migrating from Old Pattern to New Pattern
This example shows how to migrate from the legacy
addRoute
approach (with manual typings and deprecated validation)to the new typed API definition pattern using:
API.v1.post()
/.get()
chaining (so multiple HTTP methods for the same path are merged in typings)$ref
for shared model schemasExtractRoutesFromAPI
(no more manual duplication)Before – Old Pattern
Problems with the old approach:
validateParams
is deprecated → doesn’t integrate with the new pattern.rest-typings
→ easy to forget or let them get out of sync.After – New Pattern
Key Improvements in the New Pattern
Single source of truth for typings
ExtractRoutesFromAPI
pulls types directly from yourpost()
/get()
definitions — no more manual edits inrest-typings
.Strong request validation with AJV
Both
body
(POST) andquery
(GET) are validated against JSON schemas.Strong response validation
Ensures the API always returns objects that match the documented shape.
Reusable schemas with Typia
$ref: '#/components/schemas/IBaz'
links to a single IBaz schema used across APIs.Predefined error validators
validateBadRequestErrorResponse
,validateUnauthorizedErrorResponse
,validateForbiddenErrorResponse
replace repetitive error schemas.Chaining multiple methods on the same path
Calling
.post().get()
on the samefooEndpoints
ensures both methods are merged into one entry in the generatedEndpoints
interface.🧪 Testing Plan
💡 Notes