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

decorate arguments not reflected for HideField #207

Open
TMInnovations opened this issue Feb 21, 2024 · 1 comment
Open

decorate arguments not reflected for HideField #207

TMInnovations opened this issue Feb 21, 2024 · 1 comment

Comments

@TMInnovations
Copy link
Contributor

I tried to globally decorate all createdAt fields of *Create*Input models with HideField({input: true}) for testing purposes. Turns out that especially for HideField the arguments are not taken into account. As soon as I change HideField to HideFiel (f.ex.) everything works out as expeced.

schema.prisma

generator nestjsgraphql {
  decorate_1_type      = "*Create*Input"
  decorate_1_field     = "createdAt"
  decorate_1_name      = HideField
  decorate_1_from      = "@nestjs/graphql"
  decorate_1_arguments = "['{input: true}']"
}

model User {
  id                Int     @id @default(autoincrement())
  name              String
  createdAt         DateTime  @default(now())
}

Output

@InputType()
export class UserCreateInput {
    @Field(() => String, {nullable:false})
    name!: string;

    @HideField()
    createdAt?: Date | string;
}

At the moment, my workaround is to decorate each createdAt line separately.

Package Versions

    "prisma": "^4.0.0",
    "prisma-nestjs-graphql": "^18.0.2",
@TMInnovations
Copy link
Contributor Author

Location of the problem (as far as I can see):

property.decorators.push({ name: 'HideField', arguments: [] });

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

1 participant