-
Notifications
You must be signed in to change notification settings - Fork 399
Closed
Labels
status: invalidIssues with no action to take.Issues with no action to take.type: featureIssues related to new features.Issues related to new features.
Description
As per the doc, a new instance of class is generated by the class-transformer, then why it contains additional properties. For the following post data:
{
"email": "adnan11@gmail.com",
"name": "test name",
"password": "password4",
"company": "My Company"
}
And following ViewModel:
export class UserViewModel {
@MaxLength(256)
name: string;
@IsEmail()
email: string;
@MinLength(6)
@MaxLength(72) // bcrypt input limit
password: string;
roles: Array<string>
}
The class instance generated for
@HttpCode(201)
@Post()
create( @Body() user: UserViewModel) {
console.log(user);
return { message: "created"} ;
}
is
UserViewModel {
email: 'adnan11@gmail.com',
name: 'test name',
password: 'password4',
company: 'My Company' }
Where the expected object was:
UserViewModel {
email: 'adnan11@gmail.com',
name: 'test name',
password: 'password4',
roles: null }
rcarraretto, randomkms, tgercek, kop7, hezhuowei and 4 more
Metadata
Metadata
Assignees
Labels
status: invalidIssues with no action to take.Issues with no action to take.type: featureIssues related to new features.Issues related to new features.