Visitar URL original
Data Connect: Kotlin codegen: unexpected field renames of "key" and "count" · Issue #9571 · firebase/firebase-tools · GitHub
Skip to content

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

Closed

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})
}

Activity

  1. self-assigned this
    on Dec 3, 2025
  2. dconeybe commented on Dec 3, 2025

    @dconeybe
    ContributorAuthor

    Will by fixed by cl/839789976. Note that this is a BREAKING CHANGE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions