NestJS · Middle · Question 24 of 75
Why might you write a custom pipe instead of using ValidationPipe?
- ✓Correct answer: For specific transformations, e.g. turning an ID into a loaded entity, or validating with Zod schemas
- 2
ValidationPipedoesn't work with POST requests - 3Custom pipes run before middleware
Explanation
A pipe implements transform(value, metadata). Zod-based pipes are popular when schemas are shared with the front end.