dphaener/typed-api

Smarter query resolution

Opened this issue · 0 comments

It would be great if query resolution could be smarter. I had an issue when adding a TodoList in the middle of a User and a Todo. When trying to fetch all Users, the query resolver can fetch the Users and all their todo lists, but it doesn't yet know about the todos that also need to be resolved, so it is not asking for them. This raises a type error because the TodoList object must be instantiated with Todos.

Adding a strict_with_default constructor to the ApiType and providing a default value for these objects has temporarily solved the problem, but I'm not happy with it overall.

This gem: https://github.com/shopify/graphql-batch may provide some help for this issue.