From 9c5f901ddde17ebf67d7d655d2065d788f4119b5 Mon Sep 17 00:00:00 2001 From: Sam Wooler Date: Wed, 7 Jan 2026 21:38:11 +0000 Subject: [PATCH 1/2] docs(pipes): example of zod validation on specific method parameter --- content/pipes.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/content/pipes.md b/content/pipes.md index ba7db0d9eb..7f950ca8e3 100644 --- a/content/pipes.md +++ b/content/pipes.md @@ -330,6 +330,18 @@ async create(createCatDto) { > info **Hint** The `@UsePipes()` decorator is imported from the `@nestjs/common` package. +The `ZodValidationPipe` can be applied to specific parameters and alongside built-in pipes. For example, where we want to validate the route path `id` parameter with the `ParseIntPipe` seperately from the request body: + +```typescript +@Post('/:id') +async update( + @Param('id', ParseIntPipe) id: number, + @Body(new ZodValidationPipe(createCatSchema)) body: CreateCatDto +): void { + this.catsService.update(id, body); +} +``` + > warning **Warning** `zod` library requires the `strictNullChecks` configuration to be enabled in your `tsconfig.json` file. #### Class validator From 1117d9ba564f7b99ee10ad9a1f94a8f01a30964f Mon Sep 17 00:00:00 2001 From: Sam Wooler Date: Wed, 7 Jan 2026 21:44:40 +0000 Subject: [PATCH 2/2] docs(pipes): use more appropriate put http method --- content/pipes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/pipes.md b/content/pipes.md index 7f950ca8e3..b0610e3404 100644 --- a/content/pipes.md +++ b/content/pipes.md @@ -333,7 +333,7 @@ async create(createCatDto) { The `ZodValidationPipe` can be applied to specific parameters and alongside built-in pipes. For example, where we want to validate the route path `id` parameter with the `ParseIntPipe` seperately from the request body: ```typescript -@Post('/:id') +@Put('/:id') async update( @Param('id', ParseIntPipe) id: number, @Body(new ZodValidationPipe(createCatSchema)) body: CreateCatDto