Question · NestJS course · Module 10: Data Validation
@IsOptional Decorator
What does the @IsOptional() decorator in class-validator do?
Answer options
- Forces providing a null value
- Automatically sets a default value
- Marks the field as excluded from the DTO
- Skips field validation if not provided (undefined/null)
You can check the correct answer by solving this task in the CodeWorlds game.