-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
class-transformer decorators are ignored #87
Comments
thanks. added to Roadmap |
fixed in 1.9.0 version |
This fix breaks the behavior that I use in my code. I've got @Entity()
export class User {
@Column({
type: 'varchar',
length: 150,
update: false,
unique: true,
})
username: string;
@Exclude()
@Column()
password: string;
@BeforeInsert()
async hashPassword() {
this.password = await bcrypt.hash(this.password, 10);
}
} And my fixture looks like this: entity: User
parameters: {}
items:
user1:
username: '{{internet.userName}}'
password: 'test'
__call:
hashPassword:
user2:
username: '{{internet.userName}}'
password: 'test'
__call:
hashPassword: Before the fix everything worked just fine. But now Considering the fact that decorators are not ignored anymore, I removed the @RobinCK Isn't it going to be a better solution to allow users to ignore decorators by some command-line option? |
@aleksandryackovlev |
Hi, first of all, thank you for this lib. in he yaml file
then add the key in jFixturesSchema.js
add it to in Resolver.js
and finaly in Builder.js add method
then use it to configure the ignoreDecorators parameter
This way it doesn't break anything and you can disable decorator for specific entities @RobinCK I find this way more convenient than a cli option. |
Lock typeorm-fixtures-cli to 1.8.1 version SEE RobinCK/typeorm-fixtures#87
Lock typeorm-fixtures-cli to 1.8.1 version SEE RobinCK/typeorm-fixtures#87
we are having the problem that they are not ignored - even though setting ignoreDecorators to true. It will not add any field to an object that has the |
Lock typeorm-fixtures-cli to 1.8.1 version SEE RobinCK/typeorm-fixtures#87
Hello,
Thank you for this nice and handy library!
I have entity with decorators (I use DateTime type from luxon) and had problem because attribute of type DateTime cannot be created with new DateTime(). In luxon, you have to use DateTime.local() or DateTime.utc() to create new instances.
So I have write some decorators to get around this. However, my decorators are ignored when fixtures are transformed due to the parameter ignoreDecorators set to true in the call to plainToClassFromExist in Builder.js
What are the reasons for setting ignoreDecorators to true? Could you make it optional?
The text was updated successfully, but these errors were encountered: