graphql-code-generator-community icon indicating copy to clipboard operation
graphql-code-generator-community copied to clipboard

[Java] Reserved keyword "case" used in generated code

Open RaphAlreadyTaken opened this issue 1 year ago • 0 comments

Which packages are impacted by your issue?

@graphql-codegen/java

Describe the bug

When a GraphQL Mutation argument is named case (Java reserved keyword), the Java generated code uses the reserved keyword in the Mutation constructor and getter/setter. The Java code does not compile.

Your Example Website or App

https://stackblitz.com/edit/github-mxrmzq?file=schema.graphql,src%2Fmain%2Fjava%2Ftest%2FGraphqlModel.java

Steps to Reproduce the Bug or Issue

  1. Create a GraphQL schema containing a Mutation with an argument named case
  2. Use the java plugin in the codegen.yml config file
  3. Generate the Java class with yarn generate

Expected behavior

I expect the Mutation argument to be changed to a non-reserved name

Screenshots or Videos

No response

Platform

  • OS: Windows
  • NodeJS: 18.18.2
  • graphql version: 16.8.1
  • @graphql-codegen/cli version: 5.0.2
  • @graphql-codegen/java version: 4.0.1

Codegen Config File

schema:
  - schema.graphql

generates:
  src/main/java/test/GraphqlModel.java:
    plugins:
      - java:
          className: GraphqlModel

Additional context

No response

RaphAlreadyTaken avatar Mar 06 '24 10:03 RaphAlreadyTaken