The validation pipe is doing extra check since 6.6.7 that breaks the ability to use Transformer pipes in @Param decorator, as suggested in the official documentation here.
@Get(':id')
findOne(@Param('id', UserByIdPipe) userEntity: UserEntity) {
return userEntity;
}
When UserEntity is a class, this code above works in 6.6.6 but triggers Bad Request in 6.6.7
https://github.com/nestjs/nest/commit/d4bb43009b0d34480fe414baff2940bc11f913a8
Transformer pipes allow to transform the input value (here a string) to an output value (here a UserEntity so the controller will always receive an entity. This is a very powerful approach to keep controllers simple.
With the addition of the extra check, the ValidationPipe is triggering a Bad Request exception when the output type is a class and the input type does not match its type.
yarn test:e2e is all green on master but fails on branch v6.6.7_ko
https://github.com/nlenepveu/nest-validation-pipe-regression/
https://github.com/nlenepveu/nest-validation-pipe-regression/compare/v6.6.7_ko
Remove the extra check, or add a config option to the ValidationPipe to not validate the meta-type. I will be happy to help here.
Nest version: 6.6.6 -> 6.6.7
For Tooling issues:
- Node version: 12.9
- Platform: Linux
Fixed in 6.8.1. Please, let me know if you face any issue
@kamilmysliwiec working perfectly, thank you.
Thanks @kamilmysliwiec !
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.