acro5piano/typed-graphqlify

how to use nested object to make query?

dohooo opened this issue · 4 comments

how to use nested object to make query?
    const games={
        gameName : types.string,
        location : types.string,
        gameTime : types.string,
        players : ???,
    }
    const player={
        name : types.string,        
        age : types.string,        
        joinGames: [games],
    }

The game struct contains player starct。。
How do I accomplish such a nested structure?

Maybe that doesn't make sense.. But I seem to have this problem

GraphQL doesn't support recursive structures (see graphql/graphql-spec#91), so this library doesn't either. For that example, the best thing to do would probably be to move joinGames to a separate query, and have the GQL be

query ($playerId: ID!) {
  joinGames(playerId: $playerId) {
    gameName
    location
    gameTime
    players {
      name
      age
    }
  }
}

oh。 thx