Skip to content

Commit 0817165

Browse files
Merge pull request #2055 from luanpersini/patch-1
docs(controller): Add whitelist info bellow DTO explanation
2 parents e02b95a + 64de3c1 commit 0817165

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

content/controllers.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,8 @@ async create(createCatDto) {
407407
}
408408
```
409409

410+
> info **Hint** Our `ValidationPipe` can filter out properties that should not be received by the method handler. In this case, we can whitelist the acceptable properties, and any property not included in the whitelist is automatically stripped from the resulting object. In the `CreateCatDto` example, our whitelist is the `name`, `age`, and `breed` properties. Learn more [here](https://docs.nestjs.com/techniques/validation#stripping-properties).
411+
410412
#### Handling errors
411413

412414
There's a separate chapter about handling errors (i.e., working with exceptions) [here](/exception-filters).

0 commit comments

Comments
 (0)