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

Multiple @TypeGraphQL Comments on a Single Field #400

Closed
shellscape opened this issue Jul 10, 2023 · 1 comment
Closed

Multiple @TypeGraphQL Comments on a Single Field #400

shellscape opened this issue Jul 10, 2023 · 1 comment
Labels
bug Something isn't working community Something initiated by the community

Comments

@shellscape
Copy link

Describe the Bug

It doesn't appear to be possible to add multiple @TypeGraphQL comments to a single field. I have the need to specify a field as a different type, as well as exclude it from output.

To Reproduce

Attempt 1:

view users {
  /// @TypeGraphQL.field(type: "ID") @TypeGraphQL.omit(input: true)
  organization_id      String @unique
}

But this results in an obscure JSON error with a failed generate:

Error: 
✔ Generated Prisma Client (4.16.2 | library) to ./node_modules/@codegen/read in 101ms

Unexpected token ) in JSON at position 4

Attempt 2:

view users {
  /// @TypeGraphQL.field(type: "ID")
  /// @TypeGraphQL.omit(input: true)
  organization_id      String @unique
}

But this results in the field type comment being ignored and a comment being inserted into the schema (note that it's not an ID type):

  "\n@TypeGraphQL.omit(input: true)"
  organizationId: String!

Expected Behavior

organizationId: ID! in the model type, and organizationId not appears in input types.

Logs
If applicable, add some console logs to help explain your problem.
You can paste the errors with stack trace that were printed when the error occurred.

Environment (please complete the following information):

  • OS: [e.g. Windows 10 21H1] Mac OSX
  • Node (e.g. 15.8.0) v18.15.0
  • typegraphql-prisma version [e.g. 0.11.1] (please check if the bug still exist in newest release)
   "type-graphql": "2.0.0-beta.2",
    "typegraphql-prisma": "^0.26.0"
  • Prisma version [e.g. 2.18.0] v4.16.2
  • TypeScript version (e.g. 4.2.2) v5.0.4

Additional Context

@MichalLytek MichalLytek added bug Something isn't working community Something initiated by the community labels Jul 11, 2023
@MichalLytek
Copy link
Owner

Fixed via 0ab428f 🔒

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working community Something initiated by the community
Projects
None yet
Development

No branches or pull requests

2 participants