-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expected Iterable, but did not find one for field #55
Comments
Looking at the graphql/lib/resolvers/mirage.js Lines 29 to 41 in 8364bb6
|
I can't remember the auto-resolution logic at play here but it might be the case that the library will only try to auto-resolve types that implement an interface. I'll have to check as soon as I get a chance. In the meantime, you should be able to add your own resolver for the field, if you haven't done so already. |
Ok, thanks! I hadn't considered adding a field resolver |
I didn't have much luck making a field resolver.. But I was able to reproduce the issue in #56 |
I think this will work for you https://miragejs.com/repl/v2/571a844c0b: this.post("/graphql", createGraphQLHandler(graphQLSchema, this.schema, {
resolvers: {
Query: {
itemsRead(_obj, _args, context) {
const booksRead = context.mirageSchema.db.bookReads.map((book) => ({
...book,
__typename: 'BookRead'
}));
const bookChaptersRead = context.mirageSchema.db.bookChapterReads.map((chapter) => ({
...chapter,
__typename: 'BookChapterRead'
}));
return [...booksRead, ...bookChaptersRead];
}
}
}
})) Mirage's inflector doesn't seem to be able to handle the pluralization well in this case so the table names are a bit weird. |
When a schema defines a list using an interface, it looks like
@miragejs/graphql
fails to build the field for the listQuerying for..
..fails with..
..while querying other fields works fine.
I put together a reproduction in the REPL https://miragejs.com/repl/v2/042996bcd5
The text was updated successfully, but these errors were encountered: