Skip to content

Data Connect: Kotlin codegen: unexpected field renames of "key" and "count" #9571

@dconeybe

Description

@dconeybe

The Data Connect Kotlin codegen does some automatic, non-standard renaming of some selection set fields to "key" and "count".

For example, consider these two mutations:

mutation InsertItem($string: String, $int: Int) {
  items_insert(data: {string: $string, int: $int})
}
mutation UpdateItemsWithString($string: String, $int: Int) {
  items_updateMany(where: {string: {eq: $string}}, data: {int: $int})
}

This generates the following Kotlin code:

@SerialName("items_insert") val key: ItemsKey
...
@SerialName("items_updateMany") val count: Int

Note how the items_insert field is renamed to key and the items_updateMany field is renamed to count. These are unexpected and undocumented renames.

I instead expect it to generate the names from the graphql source without "magic" renaming, like this:

val items_insert: ItemsKey
...
val items_updateMany: Int

If I want those renames then I can do it myself by specifying key and count aliases, like this:

mutation InsertItem($string: String, $int: Int) {
  key: items_insert(data: {string: $string, int: $int})
}
mutation UpdateItemsWithString($string: String, $int: Int) {
  count: items_updateMany(where: {string: {eq: $string}}, data: {int: $int})
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions