Hi! Please, it is possible to change name of ENUM ...
# graphql-kotlin
f
Hi! Please, it is possible to change name of ENUM while generating graphql schema? In my case, I need to have enum name like this
name
(lowercase). Kotlin does not support this naming, because
Conflicting declarations: enum entry name, public final val name: String
. So, I want to name it with UPPERCASE and then generate enum names to GraphQL schema as lowercase (example below). I tried to use
@GraphQLName
, but it doesn't work with ENUM classes 😞
Copy code
enum class ApplicantsUpdateColumn {
    @GraphQLName("id")
    ID,

    @GraphQLName("data")
    DATA,

    @GraphQLName("name")
    NAME //I want to have this as lowercase "name"
}
I can't give it a different name, because of data model.. But I will try your suggestion with
@JsonValue
or directive.. thank you! 🙂
d
well the underlying issue is that enums have
name
(which is generally an alias to
toString()
) so you cannot have it named like that
as for the
GraphQLName
it looks like we support renaming enum class but not the values
we probably could support renaming the values as well
i believe we didn’t support it due to the deserialization issues when they are used as input properties
so if you rename your enum values you would also need to provide some additional jackson annotations to handle the deserialization
s
239 Views