Skip to content

Commit 9547f23

Browse files
committed
fix: remove old schemas, fix ChatEndpoints, use minor changeset
1 parent 219cd4b commit 9547f23

2 files changed

Lines changed: 2 additions & 85 deletions

File tree

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2-
"@rocket.chat/meteor": patch
3-
"@rocket.chat/rest-typings": patch
2+
"@rocket.chat/meteor": minor
3+
"@rocket.chat/rest-typings": minor
44
---
55

66
Add OpenAPI support for the chat.delete and chat.react API endpoints by migrating to a modern chained route definition syntax and utilizing AJV schemas for body and response validation.

packages/rest-typings/src/v1/chat.ts

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -288,79 +288,6 @@ const ChatSyncThreadsListSchema = {
288288

289289
export const isChatSyncThreadsListProps = ajv.compile<ChatSyncThreadsList>(ChatSyncThreadsListSchema);
290290

291-
type ChatDelete = {
292-
msgId: IMessage['_id'];
293-
roomId: IRoom['_id'];
294-
asUser?: boolean;
295-
};
296-
297-
const ChatDeleteSchema = {
298-
type: 'object',
299-
properties: {
300-
msgId: {
301-
type: 'string',
302-
},
303-
roomId: {
304-
type: 'string',
305-
},
306-
asUser: {
307-
type: 'boolean',
308-
nullable: true,
309-
},
310-
},
311-
required: ['msgId', 'roomId'],
312-
additionalProperties: false,
313-
};
314-
315-
export const isChatDeleteProps = ajv.compile<ChatDelete>(ChatDeleteSchema);
316-
317-
type ChatReact =
318-
| { emoji: string; messageId: IMessage['_id']; shouldReact?: boolean }
319-
| { reaction: string; messageId: IMessage['_id']; shouldReact?: boolean };
320-
321-
const ChatReactSchema = {
322-
oneOf: [
323-
{
324-
type: 'object',
325-
properties: {
326-
emoji: {
327-
type: 'string',
328-
},
329-
messageId: {
330-
type: 'string',
331-
minLength: 1,
332-
},
333-
shouldReact: {
334-
type: 'boolean',
335-
nullable: true,
336-
},
337-
},
338-
required: ['emoji', 'messageId'],
339-
additionalProperties: false,
340-
},
341-
{
342-
type: 'object',
343-
properties: {
344-
reaction: {
345-
type: 'string',
346-
},
347-
messageId: {
348-
type: 'string',
349-
minLength: 1,
350-
},
351-
shouldReact: {
352-
type: 'boolean',
353-
nullable: true,
354-
},
355-
},
356-
required: ['reaction', 'messageId'],
357-
additionalProperties: false,
358-
},
359-
],
360-
};
361-
362-
export const isChatReactProps = ajv.compile<ChatReact>(ChatReactSchema);
363-
364291
/**
365292
* The param `ignore` cannot be boolean, since this is a GET method. Use strings 'true' or 'false' instead.
366293
* @param {string} ignore
@@ -1011,16 +938,6 @@ export type ChatEndpoints = {
1011938
messages: IMessage[];
1012939
};
1013940
};
1014-
'/v1/chat.delete': {
1015-
POST: (params: ChatDelete) => {
1016-
_id: string;
1017-
ts: string;
1018-
message: Pick<IMessage, '_id' | 'rid' | 'u'>;
1019-
};
1020-
};
1021-
'/v1/chat.react': {
1022-
POST: (params: ChatReact) => void;
1023-
};
1024941
'/v1/chat.update': {
1025942
POST: (params: ChatUpdate) => {
1026943
message: IMessage;

0 commit comments

Comments
 (0)