graphql execution workflow

103 Views Asked by At

TL-DR:
How can I let the graphql.js engine recursively call resolvers|directives returning schema-unrelated-objects? any link to some in-depth doc about graphql execution flow?

Details:
I need to leverage graphql.js execution workflow in a custom way:
I'd like to let graphql engine recurse through the query, but I want my resolvers to return some specific custom object describing what and how to fetch, in such a way that eventually at the end of the GQL-query execution, a final step can gather dynamically generated structured chunks to execute a single fetch|query and return the proper response in a single round
I did some hackings combining directives and graphql-middleware
a middleware looks to be the proper tool to hook in the final step and execute the actual data fetching but something in graphql execution flow prevents me to properly recurse and gather fetch-info-objects, especially with directives.

[Edit]
I understand that as a last resort I may fallback on a manual recursion of the info object describing the incoming query
but I would end up replicating to some extent the graphql engine natural flow.
moreover, info object is quite undocumented
so I would like avoid complex manual manipulations

0

There are 0 best solutions below