I'm trying to get the following simple query:
{duel{id, players}}
and I get the following error:
Field "players" of type "[User]" must have a selection of subfields. Did you mean "players { ... }
My Duel type structure:
const DuelType = new ObjectType({
name: 'Duel',
fields: () => ({
id: { type: new NonNull(ID) },
round_id: { type: IntType },
status: { type: StringType },
turn_of_user_id: { type: IntType },
winner: { type: StringType },
players: { type: new GraphQLList(UserType) },
}),
});
Any idea what I'm missing?
Thanks.
You must specify the fields in UserType
you want to get for each item in the players
list. Assuming UserType
has a name
field, this example could work for your use case:
{
duel {
id,
players {
name
}
}
}