Closed M-Zuber closed 6 years ago
If I have the following schema:
type Book { name: String author: String } ... type Query { books(author): [Book!]! }
and a resolver
Query: { books(obj, args, context, info) { return resolver(Book, { before... // some custom filtering logic })(obj, args.filter, context, info); } }
Then when running the query, I get an error of Expected Iterable, but did not find one for field Query.books.
Expected Iterable, but did not find one for field Query.books
After debugging, the issue is coming from this check if the type is a list. as in this case, the type is GraphQLNonNull(GraphQLList)
GraphQLNonNull(GraphQLList)
https://github.com/graphql/graphql-js/blob/master/src/type/definition.js#L386
|| type.ofType instanceof GraphQLLis might fix this
|| type.ofType instanceof GraphQLLis
yeah, seems to do the trick, so made a PR
If I have the following schema:
and a resolver
Then when running the query, I get an error of
Expected Iterable, but did not find one for field Query.books
.After debugging, the issue is coming from this check if the type is a list. as in this case, the type is
GraphQLNonNull(GraphQLList)