Put in order · NestJS course · Module 2: Routing and Request Lifecycle

Introduction: Pipe Validation Order

Order the steps of data validation by ValidationPipe:

Items to put in order

  • Checking validation rules from DTO decorators
  • Throwing BadRequestException if data is invalid
  • Returning validated data to the handler
  • Receiving raw data from the request
Show the answer

Correct order:

  1. Receiving raw data from the request
  2. Checking validation rules from DTO decorators
  3. Throwing BadRequestException if data is invalid
  4. Returning validated data to the handler