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:
- Receiving raw data from the request
- Checking validation rules from DTO decorators
- Throwing BadRequestException if data is invalid
- Returning validated data to the handler