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

Kotlin Generation Failure for GraphQL Enum value ‘name’ #763

Open
jGleitz opened this issue Nov 29, 2024 · 0 comments
Open

Kotlin Generation Failure for GraphQL Enum value ‘name’ #763

jGleitz opened this issue Nov 29, 2024 · 0 comments

Comments

@jGleitz
Copy link

jGleitz commented Nov 29, 2024

When a GraphQL enum has a value name, generating Kotlin code fails with the error:

java.lang.IllegalArgumentException: constant with name "name" conflicts with a supertype member with the same name
at com.squareup.kotlinpoet.TypeSpec$Builder.addEnumConstant(TypeSpec.kt:663)

Kotlinpoet is correct: name is not an allowed enum constant in Kotlin.

A name constant should probably be treated like a reserved keyword, and the code should refer to it with _name.

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