apollo-ios: Build error when including a type and set of types

Running into an issue with conflicting types.

I have a schema definition that follows this format:

type Match {
  id: ID
  name: String
  start: Date
  winner: Team
  teams: [Team]
}
type Team {
  id: ID
  name: String
}

When trying to define it in Apollo on the iOS client, I get the build error 'Cannot convert value of type ‘Match.Team.Type’ to ‘GraphQLFragment.Type’. My definitions are

# TeamFragment.graphql
fragment Team on Team {
  id
  name
}

# MatchFragment.graphql
fragment Match on Match {
  id
  name
  start
  winner {
    ... Team
  }
  teams {
    ... Team
  }
}

If I remove the definition for the teams field, Team gets created as a GraphQL Fragment. If I add it, Team is defined as a GraphQLSelectionSet and throws a type error.

Am I simply defining these wrong?

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

Yes, it’s being worked on. I made a gigantic understatement when I said: it's going to be A Process..

The RFC was closed and I’ve started work on the rewrite, but it’s going to be A Process. I’ll make sure to update this issue when I get to it!

To be clear #939 itself is an RFC, so that’s not something that will be merged, but I’ll try to ping you when the fragments-as-protocols stuff is actually merged.

Yeah agreed. I’ll see what I can do when I’m back.