Skip to content

Commit c3eb913

Browse files
authored
chore(api): migrate chat endpoints to OpenAPI (#39820)
1 parent 2336ba3 commit c3eb913

9 files changed

Lines changed: 702 additions & 360 deletions

File tree

apps/meteor/app/api/server/ajv.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ import { ajv, ajvQuery } from '@rocket.chat/rest-typings';
33

44
const components = schemas.components?.schemas;
55
if (components) {
6+
// Patch MessageAttachmentDefault to reject unknown properties so the oneOf
7+
// discriminator works correctly (otherwise it matches every attachment).
8+
const mad = components.MessageAttachmentDefault;
9+
if (mad && typeof mad === 'object' && 'type' in mad) {
10+
(mad as Record<string, unknown>).additionalProperties = false;
11+
}
12+
613
for (const key in components) {
714
if (Object.prototype.hasOwnProperty.call(components, key)) {
815
const uri = `#/components/schemas/${key}`;

0 commit comments

Comments
 (0)