Open
Description
Description
Using the latest version of routing-controller, it seems that input validation is not working anymore. Here is my code and my setup
Minimal code-snippet showcasing the problem
export class GenerateIdentificationByEmailCommand {
@Expose()
@IsEmail()
email: string;
static setProperties(cmd: GenerateIdentificationByEmailCommand): GenerateIdentificationByEmailCommand {
return plainToClass( GenerateIdentificationByEmailCommand, cmd, { excludeExtraneousValues: true });
}
}
@Post('/email')
async generateIdentificationByEmail(
@Res() res: Response,
@Body({validate: true}) cmd: GenerateIdentificationByEmailCommand
) {
const body = GenerateIdentificationByEmailCommand.setProperties(cmd);
const result = await this._generateIdentification.execute({
provider: {
mode: AuthMode.BASIC,
email: body.email,
}
})
return res.status(201).send(result);
}
useExpressServer(app, {
defaultErrorHandler: true,
defaults: {
nullResultCode: 400,
undefinedResultCode: 204,
paramOptions: {
required: true,
},
},
classTransformer: true,
validation: true,
routePrefix: "/oks",
controllers: [
UserController,
CompanyController,
MentorController,
CommonController,
],
});
Expected behavior
I expect when request api endpoint to throw if input validation failed
Actual behavior
It does not throw when i made http request. It returns a 201 response.