Skip to content

chore: Add OpenAPI support for the e2e.setUserPublicAndPrivateKeys#39090

Open
ahmed-n-abdeltwab wants to merge 2 commits intoRocketChat:developfrom
ahmed-n-abdeltwab:feat/openapi-e2e-setUserPublicAndPrivateKeys
Open

chore: Add OpenAPI support for the e2e.setUserPublicAndPrivateKeys#39090
ahmed-n-abdeltwab wants to merge 2 commits intoRocketChat:developfrom
ahmed-n-abdeltwab:feat/openapi-e2e-setUserPublicAndPrivateKeys

Conversation

@ahmed-n-abdeltwab
Copy link
Contributor

@ahmed-n-abdeltwab ahmed-n-abdeltwab commented Feb 26, 2026

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.
  • Route Methods Chaining for the endpoints.
  • This does not introduce any breaking changes to the endpoint logic.

Issue Reference:
Relates to #34983, part of the ongoing OpenAPI integration effort.

Testing:

  • Verified that the API response schemas are correctly documented in Swagger UI.
  • All tests passed without any breaking changes

Looking forward to your feedback! 🚀

Summary by CodeRabbit

  • Refactor

    • Reworked E2E key endpoints: introduced OpenAPI-style route definitions, added request validation, and restored the separate "fetch my keys" endpoint.
  • Chores

    • Bumped minor versions for REST typings and Meteor packages.

@dionisio-bot
Copy link
Contributor

dionisio-bot bot commented Feb 26, 2026

Looks like this PR is not ready to merge, because of the following issues:

  • This PR is missing the 'stat: QA assured' label
  • This PR is missing the required milestone or project

Please fix the issues and try again

If you have any trouble, please check the PR guidelines

@changeset-bot
Copy link

changeset-bot bot commented Feb 26, 2026

🦋 Changeset detected

Latest commit: 923c9c3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 41 packages
Name Type
@rocket.chat/rest-typings Minor
@rocket.chat/meteor Minor
@rocket.chat/api-client Patch
@rocket.chat/core-services Patch
@rocket.chat/ddp-client Patch
@rocket.chat/http-router Patch
@rocket.chat/models Patch
@rocket.chat/ui-contexts Major
@rocket.chat/web-ui-registration Major
@rocket.chat/account-service Patch
@rocket.chat/authorization-service Patch
@rocket.chat/ddp-streamer Patch
@rocket.chat/federation-matrix Patch
@rocket.chat/omnichannel-services Patch
@rocket.chat/presence Patch
rocketchat-services Patch
@rocket.chat/omnichannel-transcript Patch
@rocket.chat/presence-service Patch
@rocket.chat/queue-worker Patch
@rocket.chat/abac Patch
@rocket.chat/network-broker Patch
@rocket.chat/omni-core-ee Patch
@rocket.chat/livechat Patch
@rocket.chat/mock-providers Patch
@rocket.chat/cron Patch
@rocket.chat/instance-status Patch
@rocket.chat/omni-core Patch
@rocket.chat/server-fetch Patch
@rocket.chat/ui-client Major
@rocket.chat/media-calls Patch
@rocket.chat/uikit-playground Patch
@rocket.chat/fuselage-ui-kit Major
@rocket.chat/gazzodown Major
@rocket.chat/ui-avatar Major
@rocket.chat/ui-video-conf Major
@rocket.chat/ui-voip Major
@rocket.chat/core-typings Minor
@rocket.chat/apps Patch
@rocket.chat/model-typings Patch
@rocket.chat/license Patch
@rocket.chat/pdf-worker Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 26, 2026

Walkthrough

Validation for the E2E setUserPublicAndPrivateKeys endpoint was moved from the shared rest-typings package into the local API implementation, removing the shared exported types and validators and updating the route to an action-style handler while restoring a separate fetchMyKeys GET endpoint.

Changes

Cohort / File(s) Summary
Changeset Documentation
./.changeset/quiet-moles-remain.md
Adds changeset describing OpenAPI migration for E2E endpoints and minor package version bumps.
E2E Endpoint Implementation
apps/meteor/app/api/server/v1/e2e.ts
Adds local request type, JSON schema, and AJV validator; converts e2e.setUserPublicAndPrivateKeys to an action-style route handler; reintroduces e2e.fetchMyKeys GET route.
Rest-Typings Package Index
packages/rest-typings/src/index.ts
Removes re-export of the removed E2E parameter type file.
Rest-Typings E2E Types
packages/rest-typings/src/v1/e2e.ts
Deletes exported type/validator and removes the /v1/e2e.setUserPublicAndPrivateKeys entry from E2eEndpoints.
Removed Param Type File
packages/rest-typings/src/v1/e2e/e2eSetUserPublicAndPrivateKeysParamsPOST.ts
File deleted — removed exported request type, JSON schema, and compiled AJV validator.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Client
participant API as API.v1 Route
participant Validator as AJV Validator
participant E2E as E2E Service
Client->>API: POST /v1/e2e.setUserPublicAndPrivateKeys (payload)
API->>Validator: validate(payload)
Validator-->>API: valid / invalid
alt valid
API->>E2E: set keys (public_key, private_key, force)
E2E-->>API: result
API-->>Client: 200 OK (result)
else invalid
API-->>Client: 400 Bad Request (validation error)
end

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately describes the main change: adding OpenAPI support for the e2e.setUserPublicAndPrivateKeys endpoint, which aligns with the core objective of migrating to OpenAPI patterns with AJV schema validation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ahmed-n-abdeltwab ahmed-n-abdeltwab changed the title Add OpenAPI support for the Rocket.Chat e2e.setUserPublicAndPrivateKeys Add OpenAPI support for the e2e.setUserPublicAndPrivateKeys Feb 26, 2026
@ahmed-n-abdeltwab ahmed-n-abdeltwab changed the title Add OpenAPI support for the e2e.setUserPublicAndPrivateKeys chore: Add OpenAPI support for the e2e.setUserPublicAndPrivateKeys Feb 26, 2026
@codecov
Copy link

codecov bot commented Feb 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.91%. Comparing base (5518503) to head (923c9c3).
⚠️ Report is 6 commits behind head on develop.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #39090      +/-   ##
===========================================
+ Coverage    70.85%   70.91%   +0.06%     
===========================================
  Files         3208     3208              
  Lines       113426   113426              
  Branches     20489    20487       -2     
===========================================
+ Hits         80363    80437      +74     
+ Misses       31012    30946      -66     
+ Partials      2051     2043       -8     
Flag Coverage Δ
e2e 60.42% <ø> (+0.05%) ⬆️
e2e-api 48.79% <ø> (+0.01%) ⬆️
unit 71.60% <ø> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ahmed-n-abdeltwab ahmed-n-abdeltwab marked this pull request as ready for review February 26, 2026 15:05
@ahmed-n-abdeltwab ahmed-n-abdeltwab requested review from a team as code owners February 26, 2026 15:05
@ahmed-n-abdeltwab ahmed-n-abdeltwab marked this pull request as draft February 26, 2026 15:07
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

@ahmed-n-abdeltwab ahmed-n-abdeltwab marked this pull request as ready for review February 27, 2026 15:28
@ahmed-n-abdeltwab ahmed-n-abdeltwab marked this pull request as draft February 27, 2026 15:29
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

…ivateKeys

- migrating to a modern chained route definition syntax and utilizing shared AJV schemas for validation to enhance API documentation and ensure type safety through response validation
@ahmed-n-abdeltwab ahmed-n-abdeltwab force-pushed the feat/openapi-e2e-setUserPublicAndPrivateKeys branch from 9045610 to 742992b Compare March 2, 2026 16:28
@ahmed-n-abdeltwab ahmed-n-abdeltwab marked this pull request as ready for review March 2, 2026 16:29
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 5 files

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.changeset/quiet-moles-remain.md (1)

6-6: Clarify the changeset wording around AJV schema location.

At Line 6, “utilizing shared AJV schemas” looks inaccurate for this PR context, since the validator/schema appears to have been localized to the Meteor endpoint implementation. Please update the sentence so the release note matches the actual migration behavior and avoids confusion for package consumers.

Based on learnings, OpenAPI migration PRs in apps/meteor/app/api/server/v1 should keep scope and behavior messaging tight, with no implied logic changes.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.changeset/quiet-moles-remain.md at line 6, Update the changeset wording to
remove the implication of shared schemas: replace the phrase "utilizing shared
AJV schemas" with wording that reflects the validator/schema was localized to
the Meteor endpoint implementation (e.g., "using a local AJV schema in the
Meteor endpoint"), and ensure the sentence emphasizes that this is a
documentation/route-definition migration only (no logic or scope changes in
apps/meteor/app/api/server/v1).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.changeset/quiet-moles-remain.md:
- Line 6: Update the changeset wording to remove the implication of shared
schemas: replace the phrase "utilizing shared AJV schemas" with wording that
reflects the validator/schema was localized to the Meteor endpoint
implementation (e.g., "using a local AJV schema in the Meteor endpoint"), and
ensure the sentence emphasizes that this is a documentation/route-definition
migration only (no logic or scope changes in apps/meteor/app/api/server/v1).

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 19eb837 and 742992b.

📒 Files selected for processing (2)
  • .changeset/quiet-moles-remain.md
  • apps/meteor/app/api/server/v1/e2e.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/meteor/app/api/server/v1/e2e.ts
📜 Review details
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.
Learnt from: ggazzo
Repo: RocketChat/Rocket.Chat PR: 35995
File: apps/meteor/app/api/server/v1/rooms.ts:1107-1112
Timestamp: 2026-02-23T17:53:18.785Z
Learning: In Rocket.Chat PR reviews, maintain strict scope boundaries—when a PR is focused on a specific endpoint (e.g., rooms.favorite), avoid reviewing or suggesting changes to other endpoints that were incidentally refactored (e.g., rooms.invite) unless explicitly requested by maintainers.
📚 Learning: 2026-02-24T19:09:09.561Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38974
File: apps/meteor/app/api/server/v1/im.ts:220-221
Timestamp: 2026-02-24T19:09:09.561Z
Learning: In RocketChat/Rocket.Chat OpenAPI migration PRs for apps/meteor/app/api/server/v1 endpoints, maintainers prefer to avoid any logic changes; style-only cleanups (like removing inline comments) may be deferred to follow-ups to keep scope tight.

Applied to files:

  • .changeset/quiet-moles-remain.md
📚 Learning: 2026-02-25T20:10:16.987Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 38913
File: packages/ddp-client/src/legacy/types/SDKLegacy.ts:34-34
Timestamp: 2026-02-25T20:10:16.987Z
Learning: In the RocketChat/Rocket.Chat monorepo, packages/ddp-client and apps/meteor do not use TypeScript project references. Module augmentations in apps/meteor (e.g., declare module 'rocket.chat/rest-typings') are not visible when compiling packages/ddp-client in isolation, which is why legacy SDK methods that depend on OperationResult types for OpenAPI-migrated endpoints must remain commented out.

Applied to files:

  • .changeset/quiet-moles-remain.md
📚 Learning: 2026-02-24T19:05:56.710Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: Rocket.Chat repo context: When a workspace manifest on develop already pins a dependency version (e.g., packages/web-ui-registration → "rocket.chat/ui-contexts": "27.0.1"), a lockfile change in a feature PR that upgrades only that dependency’s resolution is considered a manifest-driven sync and can be kept, preferably as a small "chore: sync yarn.lock with manifests" commit.

Applied to files:

  • .changeset/quiet-moles-remain.md
📚 Learning: 2026-02-24T19:05:56.710Z
Learnt from: ahmed-n-abdeltwab
Repo: RocketChat/Rocket.Chat PR: 0
File: :0-0
Timestamp: 2026-02-24T19:05:56.710Z
Learning: In Rocket.Chat PRs, keep feature PRs free of unrelated lockfile-only dependency bumps; prefer reverting lockfile drift or isolating such bumps into a separate "chore" commit/PR, and always use yarn install --immutable with the Yarn version pinned in package.json via Corepack.

Applied to files:

  • .changeset/quiet-moles-remain.md

@ahmed-n-abdeltwab
Copy link
Contributor Author

@ggazzo 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants