Reputation: 2119
I have the following class in nest js with this class validator:
@ValidateIf(val => val !== '*')
@IsObject()
@IsNotEmptyObject()
queryParams: DbQuery | '*';
If I send '*' it returns
[ 'queryParams must be a non-empty object' ]
Upvotes: 4
Views: 19753
Reputation: 2119
For who ever finds himself here.
@ValidateIf(val => val.queryParams !== '*')
@IsNotEmptyObject()
queryParams: DbQuery | '*';
Upvotes: 10