how to use nested object to make query?
dohooo opened this issue · 4 comments
dohooo commented
how to use nested object to make query?
dohooo commented
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?
dohooo commented
Maybe that doesn't make sense.. But I seem to have this problem
luvies commented
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
}
}
}
dohooo commented
oh。 thx