dgs-codegen icon indicating copy to clipboard operation
dgs-codegen copied to clipboard

Kotlin Generation Failure for GraphQL Enum value ‘name’

Open jGleitz opened this issue 1 year ago • 0 comments

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.

jGleitz avatar Nov 29 '24 11:11 jGleitz