Skip to content
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

Problem with @Exclude #212

Open
tdrapied opened this issue Apr 29, 2023 · 2 comments
Open

Problem with @Exclude #212

tdrapied opened this issue Apr 29, 2023 · 2 comments

Comments

@tdrapied
Copy link

The ignoreDecorators argument does not seem to work with the @exclude annotation (class-transformer) in the entity.

Is it possible to fix this?

For example:

@Entity()
export class Land {
  @PrimaryColumn()
  id: number;

  @Column()
  name: string;

  // List of land ids that are adjacent to this land
  @ApiHideProperty()
  @Exclude()
  @Column({ nullable: true, type: 'simple-json' })
  borders: Array<number>;
}
entity: Land
items:
  land1:
    id: 1
    name: Forest
    borders:
      - 2
      - 3

> Result: the borders fields are not defined.

image

@oscargdi
Copy link

oscargdi commented Aug 6, 2023

@tdrapied you can use fixtures load --ignoreDecorators <path> to change this behavior.

@harboi
Copy link

harboi commented Nov 2, 2023

Hello! I initially tried to fix this issue by using @Exclude({ toPlainOnly: true }).
Using --ignoreDecorators worked in my case, thanks @oscargdi !
Here's the command that worked for me:
fixtures-ts-node-commonjs load ./fixture -d src/app.data-source.ts --debug --ignoreDecorators

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants