-
Notifications
You must be signed in to change notification settings - Fork 839
Description
Error appears here: https://github.com/typestack/class-validator/blob/master/src/metadata/MetadataStorage.ts#L79
Everything is quiet ordinar. I have this class for validation:
export class RegisterMasterBody {
@IsEmail()
email: string;
@MinLength(6)
password: string;
name: string;
instagram?: string;
description?: string;
lat?: number;
long?: number;
}And here how I check for errors:
@Post()
@Render("register")
public async register(@Res() res: Response, @Body() body: RegisterMasterBody) {
try {
console.log(body, typeof body, body.constructor);
const errors = await validate(body, { skipMissingProperties: true });
console.log(errors, "errors of validate");
} catch (error) {
console.error(error, "POST REGISTER");
}
}in console.log typeof body - "object", constructor undefined
But inside here Error appears here: https://github.com/typestack/class-validator/blob/master/src/metadata/MetadataStorage.ts#L79 metadata.target is RegisterMasterBody
I tried to gather as much info as I can, since this is another project full of everything to strip it down and create repo with isolated reproduction :(
Class validator is the same version as in this repo.
edit: worth mention - there are more properties that do not belong to RegisterMasterBody coming in request. But I tried adding them to RegisterMastBody - did not help