class-validator is a library that lets you declare validation rules as decorators on class properties. ValidationPipe uses it internally by first converting the plain JSON body into a typed DTO class instance, then running validate() from class-validator on that instance. Any failed constraint throws BadRequestException with a detailed errors array.
Both class-validator and class-transformer must be installed — NestJS does not bundle them.