diff --git a/redisinsight/api/src/modules/pub-sub/dto/publish.dto.ts b/redisinsight/api/src/modules/pub-sub/dto/publish.dto.ts index b352f54394..abe3ee4495 100644 --- a/redisinsight/api/src/modules/pub-sub/dto/publish.dto.ts +++ b/redisinsight/api/src/modules/pub-sub/dto/publish.dto.ts @@ -1,5 +1,6 @@ import { - IsNotEmpty, IsString, + IsDefined, + IsString, } from 'class-validator'; import { ApiProperty } from '@nestjs/swagger'; @@ -9,7 +10,7 @@ export class PublishDto { description: 'Message to send', example: '{"hello":"world"}', }) - @IsNotEmpty() + @IsDefined() @IsString() message: string; @@ -18,7 +19,7 @@ export class PublishDto { description: 'Chanel name', example: 'channel-1', }) - @IsNotEmpty() + @IsDefined() @IsString() channel: string; } diff --git a/redisinsight/api/test/api/pub-sub/POST-instance-id-pub-sub-messages.test.ts b/redisinsight/api/test/api/pub-sub/POST-instance-id-pub-sub-messages.test.ts index 7ce81b166c..5202b75af5 100644 --- a/redisinsight/api/test/api/pub-sub/POST-instance-id-pub-sub-messages.test.ts +++ b/redisinsight/api/test/api/pub-sub/POST-instance-id-pub-sub-messages.test.ts @@ -16,10 +16,8 @@ const endpoint = (instanceId = constants.TEST_INSTANCE_ID) => request(server).post(`/instance/${instanceId}/pub-sub/messages`); const dataSchema = Joi.object({ - channel: Joi.string().required(), - message: Joi.string().required(), -}).messages({ - 'any.required': '{#label} should not be empty', + channel: Joi.string().allow('').required(), + message: Joi.string().allow('').required(), }).strict(); const validInputData = {