-
Notifications
You must be signed in to change notification settings - Fork 11k
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
Chore: add Ajv JSON Schema to api/v1 #25601
Conversation
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.
put some Prop
at the end of types and functions assertions
2b778ef
to
8f93798
Compare
8378b50
to
830f53a
Compare
… into chore/add-json-schema-to-api/v1
…at/Rocket.Chat into chore/add-json-schema-to-api/v1
packages/rest-typings/src/v1/voip.ts
Outdated
@@ -8,72 +8,536 @@ import type { | |||
IVoipExtensionWithAgentInfo, | |||
IManagementServerConnectionStatus, | |||
IRegistrationInfo, | |||
VoipClientEvents, | |||
// VoipClientEvents, |
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.
// VoipClientEvents, |
@@ -28,7 +28,7 @@ | |||
"obj:dev": "TEST_MODE=true yarn dev", | |||
"stylelint": "stylelint \"app/**/*.css\" \"client/**/*.css\" \"app/**/*.less\" \"client/**/*.less\" \"ee/**/*.less\"", | |||
"stylelint:fix": "stylelint --fix \"app/**/*.css\" \"client/**/*.css\" \"app/**/*.less\" \"client/**/*.less\" \"ee/**/*.less\"", | |||
"typecheck": "cross-env NODE_OPTIONS=\"--max-old-space-size=4092\" tsc --noEmit --skipLibCheck", | |||
"typecheck": "cross-env NODE_OPTIONS=\"--max-old-space-size=8184\" tsc --noEmit --skipLibCheck", |
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.
😭
type: 'object', | ||
properties: { | ||
platform: { | ||
type: 'string', |
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.
Since bannerPlatform is an enum
, maybe you can use the enum
key here?
type: 'string', | |
enum: ['1', '2'], |
@@ -1,76 +1,462 @@ | |||
import type { IMessage, IRoom, ReadReceipt } from '@rocket.chat/core-typings'; | |||
import Ajv from 'ajv'; |
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.
This may be a bit picky, but would be great to have a separate file for the AJV schemas, otherwise these definition files would be really huge (and a bit messy, depending on who sees it) 👀
(Was thinking on moving these defs to the end of the file, but there's an eslint rule we use to prevent that i think)
}, | ||
resend: { | ||
type: 'string', | ||
nullable: true, |
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.
Maybe this prop can be in optionalProperties
key? 👀
additionalProperties: false, | ||
}; | ||
|
||
export const isLivechatDepartmentDepartmentIdAgentsPOSTProps = ajv.compile<LivechatDepartmentDepartmentIdAgentsPOST>( |
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.
This kind of types would become more common, would be good to define an "standard" for it, like GETLivechatDepartmentIdAgents
and POSTLivechatDepartmentIdAgents
, prefixing the method to all typedefs
nullable: true, | ||
}, | ||
}, | ||
required: [], |
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.
I believe required can be omitted when no prop is required
Co-authored-by: Pierre Lehnen <[email protected]>
…message-body * 'develop' of github.com:RocketChat/Rocket.Chat: [IMPROVE] Refactor + unit tests for federation-v2 (#25680) [FIX] user status Offline misnamed as Invisible in Custom Status edit dropdown menu (#24796) Chore: Messages raw model rewrite to ts (#25761) Chore: migrate katex to ts (#25501) Chore: AutoTranslate contextualBar rewrite (#25751) Chore: Replace AnnouncementModal in favor of GenericModal (#25752) Chore: Keyboard shortcuts contextualBar rewrite (#25753) Chore: Prune Messages contextualBar rewrite (#25757) Chore: add Ajv JSON Schema to api/v1 (#25601) Update package.json (#25755) Update CODEOWNERS Chore: remove duplicated NotFoundPage.js (#25749)
* origin/develop: (45 commits) [FIX] Thread Message Preview (#25709) [FIX] Bump meteor-node-stubs to version 1.2.3 (#25669) [IMPROVE] Refactor + unit tests for federation-v2 (#25680) [FIX] user status Offline misnamed as Invisible in Custom Status edit dropdown menu (#24796) Chore: Messages raw model rewrite to ts (#25761) Chore: migrate katex to ts (#25501) Chore: AutoTranslate contextualBar rewrite (#25751) Chore: Replace AnnouncementModal in favor of GenericModal (#25752) Chore: Keyboard shortcuts contextualBar rewrite (#25753) Chore: Prune Messages contextualBar rewrite (#25757) Chore: add Ajv JSON Schema to api/v1 (#25601) Update package.json (#25755) Update CODEOWNERS Chore: remove duplicated NotFoundPage.js (#25749) Chore: command's endpoints (#25630) Chore: Fix incorrect checksum for agenda package (cause of breaking develop builds) (#25741) Chore: Remove duplicate checksumBehavior key from yarn file (#25730) [FIX] Custom emoji reaction size (#25393) Chore: Test for department screen (#25696) Chore: Taking out Blaze from routes with `MainLayout` (#25697) ...
* origin/develop: (26 commits) [FIX] Thread Message Preview (#25709) [FIX] Bump meteor-node-stubs to version 1.2.3 (#25669) [IMPROVE] Refactor + unit tests for federation-v2 (#25680) [FIX] user status Offline misnamed as Invisible in Custom Status edit dropdown menu (#24796) Chore: Messages raw model rewrite to ts (#25761) Chore: migrate katex to ts (#25501) Chore: AutoTranslate contextualBar rewrite (#25751) Chore: Replace AnnouncementModal in favor of GenericModal (#25752) Chore: Keyboard shortcuts contextualBar rewrite (#25753) Chore: Prune Messages contextualBar rewrite (#25757) Chore: add Ajv JSON Schema to api/v1 (#25601) Update package.json (#25755) Update CODEOWNERS Chore: remove duplicated NotFoundPage.js (#25749) Chore: command's endpoints (#25630) Chore: Fix incorrect checksum for agenda package (cause of breaking develop builds) (#25741) Chore: Remove duplicate checksumBehavior key from yarn file (#25730) [FIX] Custom emoji reaction size (#25393) Chore: Test for department screen (#25696) Chore: Taking out Blaze from routes with `MainLayout` (#25697) ...
Proposed changes (including videos or screenshots)
This pull request adds Ajv JSON Schema validation to
apps/meteor/app/api/server/v1/
andpackages/rest-typings/src/v1/
, where needed.Issue(s)
Steps to test or reproduce
Further comments