0
0
NestJSframework~10 mins

ValidationPipe in depth in NestJS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to apply ValidationPipe globally in a NestJS app.

NestJS
app.useGlobalPipes(new [1]());
Drag options to blanks, or click blank then click option'
AValidationPipe
BParseIntPipe
CAuthGuard
DLogger
Attempts:
3 left
💡 Hint
Common Mistakes
Using a pipe that does not validate data like ParseIntPipe.
Forgetting to create a new instance with parentheses.
2fill in blank
medium

Complete the code to enable automatic transformation of input data types in ValidationPipe.

NestJS
app.useGlobalPipes(new ValidationPipe({ [1]: true }));
Drag options to blanks, or click blank then click option'
Atransform
Bwhitelist
CforbidNonWhitelisted
DskipMissingProperties
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'whitelist' with 'transform'.
Not enabling transform causes input to remain strings.
3fill in blank
hard

Fix the error in the code to forbid properties not in the DTO during validation.

NestJS
app.useGlobalPipes(new ValidationPipe({ [1]: true }));
Drag options to blanks, or click blank then click option'
AskipMissingProperties
BdisableErrorMessages
Ctransform
DforbidNonWhitelisted
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'whitelist' instead of 'forbidNonWhitelisted'.
Not enabling this option allows extra properties silently.
4fill in blank
hard

Fill both blanks to create a ValidationPipe that strips unknown properties and skips missing ones.

NestJS
new ValidationPipe({ [1]: true, [2]: true })
Drag options to blanks, or click blank then click option'
Awhitelist
BskipMissingProperties
CforbidNonWhitelisted
Dtransform
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing 'forbidNonWhitelisted' with 'whitelist'.
Not using 'skipMissingProperties' when optional fields are missing.
5fill in blank
hard

Fill all three blanks to create a ValidationPipe with transformation, whitelist, and forbidding unknown properties.

NestJS
new ValidationPipe({ [1]: true, [2]: true, [3]: true })
Drag options to blanks, or click blank then click option'
AskipMissingProperties
Bwhitelist
CforbidNonWhitelisted
Dtransform
Attempts:
3 left
💡 Hint
Common Mistakes
Missing one of the three options causes unexpected behavior.
Confusing 'skipMissingProperties' with 'forbidNonWhitelisted'.