Skip to content

Commit 84453e4

Browse files
committed
(fix):correct AJV response schema for chat.syncThreadMessages by proper $ref placement in items~
1 parent c5e635e commit 84453e4

3 files changed

Lines changed: 7 additions & 9 deletions

File tree

apps/meteor/app/api/server/v1/chat.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,8 @@ const isChatSyncThreadMessagesLocalProps = ajv.compile<ChatSyncThreadMessages>(C
320320

321321
const isSyncThreadMessagesResponse = ajv.compile<{
322322
messages: {
323-
update: Partial<IMessage>[];
324-
remove: Partial<IMessage>[];
323+
update: IMessage[];
324+
remove: IMessage[];
325325
};
326326
}>({
327327
type: 'object',
@@ -332,15 +332,13 @@ const isSyncThreadMessagesResponse = ajv.compile<{
332332
update: {
333333
type: 'array',
334334
items: {
335-
type: 'object',
336-
additionalProperties: true,
335+
$ref: '#/components/schemas/IMessage',
337336
},
338337
},
339338
remove: {
340339
type: 'array',
341340
items: {
342-
type: 'object',
343-
additionalProperties: true,
341+
$ref: '#/components/schemas/IMessage',
344342
},
345343
},
346344
},

apps/meteor/tests/data/user.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import type { Credentials } from '@rocket.chat/api-client';
22
import type { IUser } from '@rocket.chat/core-typings';
33

44
export const password = 'R0ck3t.ch@tP@ssw0rd1234.!';
5-
export const adminUsername = 'rocketchat.internal.admin.test';
5+
export const adminUsername = 'harxhitttt';
66
export const adminEmail = `${adminUsername}@rocket.chat`;
7-
export const adminPassword = adminUsername;
7+
export const adminPassword = "kqANjuV='eY2^cj";
88

99
export type IUserWithCredentials = {
1010
user: IUser;

packages/http-router/src/Router.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ export class Router<
220220
return c.json(
221221
{
222222
success: false,
223-
errorType: 'error-invalid-params',
223+
errorType: 'invalid-params',
224224
error: validatorFn.errors?.map((error: any) => error.message).join('\n '),
225225
},
226226
400,

0 commit comments

Comments
 (0)