graphql-server icon indicating copy to clipboard operation
graphql-server copied to clipboard

Projection resolution failing

Open martinjuhasz opened this issue 9 years ago • 0 comments

I tried implementing GraphQL schemas using your sample code. You use the resolve method on a GraphQLObjectType with the following parameters: root, {id}, source, fieldASTs.

Your fieldASTs object seems to be a list containing the selectionSet that you reduce to map them to the wanted projections. Anyway when using the current version of graphql-js the object that gets returend to me is an array (atm it includes only one element) that then includes a list with the wanted selectionSet.

Any idea if this has changed and your code uses and older version or if i'm missing something? I don't get why it's an array with a single element. My current solution which works but seem's just not right:

return syntaxTree.fieldASTs[0].selectionSet.selections.reduce((projections, selection) => {})

martinjuhasz avatar Jun 23 '16 10:06 martinjuhasz