class Product {
@Min(0, { message: 'should be positive number' })
@IsNotEmpty({ message: 'should not be empty' })
@Type(() => Number)
price: number;
}
*In this case, price come from input value, so it should be string at first.
I want to show error message that following cases by class-validator, but only @IsNotEmpty not working.
- If field is empty, show 'should not be empty'
- If field is not empty && field value is negative, show 'should be positive number'
why @IsNotEmpty not working with @Type type function?