Skip to main content
Version: 6.x.x

Renaming Fields

By default, the schema generator will use the simple name of the underlying class for the type names and function/property names for fields. You can change this default behavior by annotating the target class/field with @GraphQLName. The following Kotlin Widget class will be renamed to MyCustomName GraphQL type and its fields will also be renamed.

data class Widget(
val value: Int?
type MyCustomName {
myCustomField: Int

Known Issues

Due to how we deserialize input classes, if you rename a field of an input class or an enum value you must also annotate it with the Jackson annotation @JsonProperty. See issue 493 for more info.

data class MyInputClass(
val field1: String

// GraphQL enums should use UPPER_CASE naming if possible, but any case is supported
enum class Selection {



class QueryClass {
fun parseData(arg: MyInputClass) = "You sent ${arg.field1}"

fun chooseValue(selection: Selection): String = when (selection) {
Selection.ONE -> "You chose the first value"
Selection.TWO -> "You chose the second value"
input MyInputClassInput {
# This only works if both @JsonProperty and @GraphQLName are present
renamedField: String!

enum Selection {

type Query {
parseData(arg: MyInputClass!): String!
chooseValue(selection: Selection!): String!