Skip to content

Commit 692dbfd

Browse files
sezallagwalamitb0ra
authored andcommitted
fix: remove old schemas, fix ChatEndpoints, use minor changeset
1 parent ed22f02 commit 692dbfd

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
@@ -218,79 +218,6 @@ const ChatSyncThreadsListSchema = {
218218

219219
export const isChatSyncThreadsListProps = ajv.compile<ChatSyncThreadsList>(ChatSyncThreadsListSchema);
220220

221-
type ChatDelete = {
222-
msgId: IMessage['_id'];
223-
roomId: IRoom['_id'];
224-
asUser?: boolean;
225-
};
226-
227-
const ChatDeleteSchema = {
228-
type: 'object',
229-
properties: {
230-
msgId: {
231-
type: 'string',
232-
},
233-
roomId: {
234-
type: 'string',
235-
},
236-
asUser: {
237-
type: 'boolean',
238-
nullable: true,
239-
},
240-
},
241-
required: ['msgId', 'roomId'],
242-
additionalProperties: false,
243-
};
244-
245-
export const isChatDeleteProps = ajv.compile<ChatDelete>(ChatDeleteSchema);
246-
247-
type ChatReact =
248-
| { emoji: string; messageId: IMessage['_id']; shouldReact?: boolean }
249-
| { reaction: string; messageId: IMessage['_id']; shouldReact?: boolean };
250-
251-
const ChatReactSchema = {
252-
oneOf: [
253-
{
254-
type: 'object',
255-
properties: {
256-
emoji: {
257-
type: 'string',
258-
},
259-
messageId: {
260-
type: 'string',
261-
minLength: 1,
262-
},
263-
shouldReact: {
264-
type: 'boolean',
265-
nullable: true,
266-
},
267-
},
268-
required: ['emoji', 'messageId'],
269-
additionalProperties: false,
270-
},
271-
{
272-
type: 'object',
273-
properties: {
274-
reaction: {
275-
type: 'string',
276-
},
277-
messageId: {
278-
type: 'string',
279-
minLength: 1,
280-
},
281-
shouldReact: {
282-
type: 'boolean',
283-
nullable: true,
284-
},
285-
},
286-
required: ['reaction', 'messageId'],
287-
additionalProperties: false,
288-
},
289-
],
290-
};
291-
292-
export const isChatReactProps = ajv.compile<ChatReact>(ChatReactSchema);
293-
294221
/**
295222
* The param `ignore` cannot be boolean, since this is a GET method. Use strings 'true' or 'false' instead.
296223
* @param {string} ignore
@@ -929,16 +856,6 @@ export type ChatEndpoints = {
929856
messages: IMessage[];
930857
};
931858
};
932-
'/v1/chat.delete': {
933-
POST: (params: ChatDelete) => {
934-
_id: string;
935-
ts: string;
936-
message: Pick<IMessage, '_id' | 'rid' | 'u'>;
937-
};
938-
};
939-
'/v1/chat.react': {
940-
POST: (params: ChatReact) => void;
941-
};
942859
'/v1/chat.update': {
943860
POST: (params: ChatUpdate) => {
944861
message: IMessage;

0 commit comments

Comments
 (0)