Complete the code to import Joi for validation.
import * as [1] from 'joi';
Joi is imported as a namespace to use its validation functions.
Complete the code to define a Joi schema for a username that is a required string.
const schema = Joi.object({ username: Joi.[1]().required() });number() or boolean() instead of string().required() to make the field mandatory.The username should be a string, so we use Joi.string().
Fix the error in the validation pipe setup by completing the missing property.
app.useGlobalPipes(new ValidationPipe({ whitelist: [1] }));Setting whitelist: true removes properties not in the DTO.
Fill both blanks to create a Joi schema for an email that is required and must be valid.
const schema = Joi.object({ email: Joi.[1]().[2]() });email() instead of string() (email is a validator, not a type).required().Email should be a string and required, so use string() and required().
Fill all three blanks to create a Joi schema for a password that is a required string with minimum length 8.
const schema = Joi.object({ password: Joi.[1]().min([2]).[3]() });number() instead of string().required().min to a string instead of a number.Password must be a string, at least 8 characters, and required.
