Validation on optional Parameter using class-validator in nestjs?

You can use the @IsOptional() validator:

Checks if given value is empty (=== null, === undefined) and if so, ignores all the validators on the property.

Leave a Comment