-
Notifications
You must be signed in to change notification settings - Fork 11.7k
feat: Add OpenAPI Support to Statistics API #35692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
feat: Add OpenAPI Support to Statistics API #35692
Conversation
Replaced nested ternary operators with a cleaner lookup-based approach for better readability and maintainability. No functional changes. Related to RocketChat#34983, but does not fully resolve it.
chore: bump ubuntu (RocketChat#35676)
Replaced any type with unknown for the avoid of using any. No functional changes.
Replaced implicit any fallbacks with explicit unknown types. No functional changes. Related to RocketChat#34983, but does not fully resolve it.
Looks like this PR is not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
ahmed-n-abdeltwab seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
@kody start-review |
Code Review Completed! 🔥The code review was successfully completed based on your current configurations. Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
I usually run To resolve this, I reverted the unintended changes and manually fixed only my file using the following command: npx eslint --parser @typescript-eslint/parser --parser-options "project: ['./tsconfig.base.json']" apps/meteor/app/api/server/v1/stats.ts --fix This ensured that only the intended file was fixed and committed correctly. |
@kody start-review |
Kody Review CompleteGreat news! 🎉 Keep up the excellent work! 🚀 Kody Guide: Usage and ConfigurationInteracting with Kody
Current Kody ConfigurationReview OptionsThe following review options are enabled or disabled:
|
@kody start-review |
Thanks for your help! I'll leave the changes as they are and focus on fixing the errors. If I have questions about the scripts in the Thanks again |
Co-authored-by: ahmed-n-abdeltwab <[email protected]>
I resolved the issue by adding 400 and 401 response schemas to each endpoint and correcting the query properties according to the documentation from the website. Here is the result after running
|
Awesome! Thank you @ahmed-n-abdeltwab ! Just triggered the CI run |
You're welcome! Let me know if there’s anything else I can help with |
Co-authored-by: ahmed-n-abdeltwab <[email protected]>
📊 Add Response Schema for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ahmed-n-abdeltwab great job on the summary you just provided. 👏
Looks like you missed some linting errors:
If you can use VSCode and the eslint and prettier extensions, it should be easier to spot these before committing. If you need a lighter-weight editor maybe try zed.dev which has these built-in.
Otherwise, you can always run yarn lint
.
Please do this before you push, since the CI won't run the test suite if it fails the lint phase.
I suggested the changes below, but as an exercise I recommend that you make them yourself instead of using github's 'Commit suggestion' button.
Thanks a lot! I really appreciated your feedback. I had already switched my editor to VSCode as you previously recommended, and I installed both the ESLint and Prettier extensions. They definitely helped me catch the linting issues more easily. I will also run |
…bjects to strings Co-authored-by: ahmed-n-abdeltwab <[email protected]>
📊 fix: update comments for clarity
🚧 Issues
Should I investigate this issue or leave it as is? |
@ahmed-n-abdeltwab great job on the comments 👍 Don't worry about lint issues not related to the files you changed. |
📊 Fix Response Schema for
|
📊 Update Response Schema for
|
📊 Enhance Statistics Endpoints
🐛 Problems I FoundThe interface marks this properties as required, but it’s actually optional in the response. This caused AJV validation to fail, so I commented it out in the required array.
✅ Test ResultsThe tests were executed successfully, and all passed. $ yarn testapi -f 'statistics'
[Statistics]
[/statistics]
✔ should return an error when the user does not have the necessary permission (350ms)
✔ should return an object with the statistics (254ms)
✔ should update the statistics when is provided the "refresh:true" query parameter (2364ms)
[/statistics.list]
✔ should return an error when the user does not have the necessary permission (224ms)
✔ should return an array with the statistics (304ms)
✔ should return an array with the statistics even requested with count and offset params (207ms)
6 passing (5s) Looking forward to your feedback! 🚀 |
Description:
This PR integrates OpenAPI support into the
Rocket.Chat API
, migrate ofRocket.Chat API
endpoints to the new OpenAPI pattern. The update includes improved API documentation, enhanced type safety, and response validation using AJV.Key Changes:
Issue Reference:
Relates to #34983, part of the ongoing OpenAPI integration effort.
Testing:
Endpoints Migration:
Looking forward to your feedback! 🚀
Description
This pull request introduces OpenAPI support to the statistics API in the
ahmed-n-abdeltwab/Rocket.Chat
repository. The changes are made in theapps/meteor/app/api/server/v1/stats.ts
file. The update involves refactoring the statistics API routes to incorporate typed validation using ajv schema definitions. This enhancement aims to improve type safety and request validation while preserving the existing functionality of the API. The changes are proposed from thefeat/OpenAPI
branch to be merged into thedevelop
branch.