dotansimha / dotansimha/graphql-code-generator-community

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

Open
#648 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

### 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_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.