Open
Description
Hi I want to validate the EmittedMessage using the DTO but the validation is not working. I am using Google Pubsub microservice.
export class OrderDTO {
@IsString()
@IsNotEmpty()
public id: string;
...
}
@EventPattern(PS_SUBSCRIPTION_EVENTS.CREATE_ORDER_SUBSCRIBE)
public async handleOrderReceivedFromCustomer(
@Payload(ValidationPipe)
data: EmittedMessage<OrderDTO>,
): Promise<void> {
const order = <OrderDTO>data.payload;
// Do something
}
I have added global validation pipe, tried with controller/param level validation pipes using @UsePipes
but still it goes inside the consoller function without throwing the error if I send the empty object in Google Pubsub event data.