graphql-code-generator-community
graphql-code-generator-community copied to clipboard
[Java] Reserved keyword "case" used in generated code
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
- Create a GraphQL schema containing a Mutation with an argument named
case - Use the
javaplugin in the codegen.yml config file - 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
graphqlversion: 16.8.1@graphql-codegen/cliversion: 5.0.2@graphql-codegen/javaversion: 4.0.1
Codegen Config File
schema:
- schema.graphql
generates:
src/main/java/test/GraphqlModel.java:
plugins:
- java:
className: GraphqlModel
Additional context
No response