Skip to content

refactor(api): migrate users.getUsernameSuggestion endpoint to openapi with ajv validation#39703

Open
CodeMatrix1 wants to merge 2 commits intoRocketChat:developfrom
CodeMatrix1:refactor/api-migrate-users-getUsernameSuggestion
Open

refactor(api): migrate users.getUsernameSuggestion endpoint to openapi with ajv validation#39703
CodeMatrix1 wants to merge 2 commits intoRocketChat:developfrom
CodeMatrix1:refactor/api-migrate-users-getUsernameSuggestion

Conversation

@CodeMatrix1
Copy link
Copy Markdown

@CodeMatrix1 CodeMatrix1 commented Mar 18, 2026

Summary

This PR migrates the users.getUserNameSuggestion endpoint from the deprecated API.v1.addRoute format to the new declarative API route format.

Changes

  • Replaced API.v1.addRoute with API.v1.post
  • Added request body validation
  • Added response schema validation
  • Maintained existing endpoint behavior

Successful Runs

image image image

Issues

RocketChat/Rocket.Chat-Open-API#150

Summary by CodeRabbit

  • API Improvements
    • Standardized the users.getUsernameSuggestion endpoint to align with current API standards and architecture.

@CodeMatrix1 CodeMatrix1 requested review from a team as code owners March 18, 2026 08:11
@dionisio-bot
Copy link
Copy Markdown
Contributor

dionisio-bot bot commented Mar 18, 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
Copy Markdown

changeset-bot bot commented Mar 18, 2026

🦋 Changeset detected

Latest commit: 36e7d3d

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
Copy Markdown
Contributor

coderabbitai bot commented Mar 18, 2026

Walkthrough

This change migrates the users.getUsernameSuggestion endpoint to use OpenAPI and AJV compatible structure. The endpoint is consolidated into a centralized endpoints collection instead of existing as a standalone declaration, with associated type definitions updated accordingly.

Changes

Cohort / File(s) Summary
Changeset Metadata
.changeset/migrate-users-getUsernameSuggestion-to-AJV.md
Added changelog entry documenting the migration to OpenAPI and AJV compatibility for minor version bump in @rocket.chat/rest-typings and @rocket.chat/meteor packages.
API Route Implementation
apps/meteor/app/api/server/v1/users.ts
Consolidated users.getUsernameSuggestion endpoint into the centralized endpoints collection with authentication and username-suggestion response schema; removed previous standalone route declaration.
Type Definitions
packages/rest-typings/src/v1/users.ts
Removed the legacy GET endpoint definition for '/v1/users.getUsernameSuggestion' from UsersEndpoints type; new structure likely auto-generates type definitions.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 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.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title accurately describes the main change: migrating the users.getUsernameSuggestion endpoint to OpenAPI with AJV validation, which aligns with the changeset and code modifications.

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

📝 Coding Plan
  • Generate coding plan for human review comments

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.

@CodeMatrix1 CodeMatrix1 changed the title refactor(api): migrate users.getUsernameSuggestion endpoint to new AP… refactor(api): migrate users.getUsernameSuggestion endpoint to openapi with ajv validation Mar 18, 2026
Copy link
Copy Markdown
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.

1 issue found across 3 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="packages/rest-typings/src/v1/users.ts">

<violation number="1" location="packages/rest-typings/src/v1/users.ts:252">
P2: `users.getUsernameSuggestion` was removed from REST typings even though the endpoint still exists, causing `@rocket.chat/rest-typings` to be out of sync with the actual API contract.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

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.

1 participant