0
0
NestJSframework~10 mins

Whitelist and transform options 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 enable whitelist in ValidationPipe.

NestJS
app.useGlobalPipes(new ValidationPipe({ whitelist: [1] }));
Drag options to blanks, or click blank then click option'
Afalse
Btrue
Cnull
Dundefined
Attempts:
3 left
💡 Hint
Common Mistakes
Using false disables whitelist and allows extra properties.
Passing null or undefined causes runtime errors.
2fill in blank
medium

Complete the code to enable automatic transformation in ValidationPipe.

NestJS
app.useGlobalPipes(new ValidationPipe({ transform: [1] }));
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
Cnull
Dundefined
Attempts:
3 left
💡 Hint
Common Mistakes
Setting transform to false disables automatic conversion.
Passing null or undefined does not enable transformation.
3fill in blank
hard

Fix the error in the ValidationPipe options to whitelist and transform correctly.

NestJS
app.useGlobalPipes(new ValidationPipe({ whitelist: [1], transform: [2] }));
Drag options to blanks, or click blank then click option'
Afalse
Btrue
Cnull
Dundefined
Attempts:
3 left
💡 Hint
Common Mistakes
Setting one option to false disables that feature.
Using null or undefined causes unexpected behavior.
4fill in blank
hard

Fill both blanks to configure ValidationPipe with whitelist and transform enabled.

NestJS
app.useGlobalPipes(new ValidationPipe({ whitelist: [1], transform: [2] }));
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
Cnull
Dundefined
Attempts:
3 left
💡 Hint
Common Mistakes
Setting either option to false disables that feature.
Using null or undefined leads to errors.
5fill in blank
hard

Fill all three blanks to configure ValidationPipe with whitelist, transform, and forbidNonWhitelisted options.

NestJS
app.useGlobalPipes(new ValidationPipe({ whitelist: [1], transform: [2], forbidNonWhitelisted: [3] }));
Drag options to blanks, or click blank then click option'
Atrue
Bfalse
Cnull
Dundefined
Attempts:
3 left
💡 Hint
Common Mistakes
Setting forbidNonWhitelisted to true causes validation errors on extra properties.
Using null or undefined for any option causes unexpected behavior.