Reputation: 16
In main.ts I have set a Global Pipe looking like this:
app.useGlobalPipes(
new ValidationPipe({
whitelist: true,
transform: true,
transformOptions: { enableImplicitConversion: true },
})
);
At the controller level I have a pipe set up this way:
@UsePipes(new ValidationPipe({ transform: true }))
My question is: which Pipe is used at the controller level? Will the whitelist property from global Pipe stack up and apply also on the controller ( making the controller level pipe to be useless ), or the controller pipe is the one overriding the global settings, thus the only ValidationPipe operation will be transform:true
?
Upvotes: 0
Views: 4106
Reputation: 70191
The answer is both pipes will be used. According to the docs the global pipe will be applied first, then the controller level pipe will be applied. This will probably result in an error due to trying to re-call plainToClass
, but if not then it will just end up in taking extra time for the request
Upvotes: 1