Apollo-android: fieldA cannot be merged with fieldB: they have different shapes

Created on 20 Mar 2021  路  3Comments  路  Source: apollographql/apollo-android

Summary
Error info: Failed to parse path-to-graphql-file:
fieldA cannot be merged with fieldB: they have different shapes

Here fieldA has the same name with fieldB, but different nullability.

Version

  • apollo-android: 3.0.0-SNAPSHOT
  • Android Studio: Android Studio Arctic Fox | 2020.3.1 Canary 10
  • Gradle: 6.8.2

Description

  • Content of my graphql file:
fragment PinnableItem on PinnableItem {
  __typename
   # https://docs.github.com/en/graphql/reference/objects#repository
  ... on Repository {
    owner {
      ... on RepositoryOwner { # non-null
        # A URL pointing to the owner's public avatar.
        avatarUrl
        # The username used to login.
        login
        # The HTTP URL for the owner.
        resourcePath
        # The HTTP URL for the owner.
        url
      }
    }
  }
  # https://docs.github.com/en/graphql/reference/objects#gist
  ... on Gist {
    owner {
      ... on RepositoryOwner { # nullable
        # A URL pointing to the owner's public avatar.
        avatarUrl
        # The username used to login.
        login
        # The HTTP URL for the owner.
        resourcePath
        # The HTTP URL for the owner.
        url
      }
    }
  }
}
Bug

Most helpful comment

Thanks for the quick response, you saved my day!

My code above doesn't work in Github explore. But it actually works on an old stable version(2.5.3) of apollo-android. So I thought it might be a bug of new version of apollo-android 馃槀. Anyway, my problem solved, really appreciate 鉂わ笍.

All 3 comments

Hi @TonnyL 馃憢 ! I think this is how it is supposed to work? From https://spec.graphql.org/June2018/#sec-Field-Selection-Merging:

If typeA or typeB is Non鈥怤ull.
If typeA or typeB is nullable, return false.
Let typeA be the nullable type of typeA
Let typeB be the nullable type of typeB

Does it actually work in the Github explorer?

Thanks for the quick response, you saved my day!

My code above doesn't work in Github explore. But it actually works on an old stable version(2.5.3) of apollo-android. So I thought it might be a bug of new version of apollo-android 馃槀. Anyway, my problem solved, really appreciate 鉂わ笍.

Sure thing !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

juliafu1 picture juliafu1  路  4Comments

rnitame picture rnitame  路  3Comments

john-lanticse picture john-lanticse  路  3Comments

sav007 picture sav007  路  4Comments

mmahesh2019 picture mmahesh2019  路  4Comments