You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Allow multiple operations to be executed in one call #806
As for thoughts on this the real challenge is the "protocol" for returning results. Should they be combined? Should they feed into each other via "variables" and hence need dependency resolution?
Should the results be "streamed" much like subscription such that a client gets operation A, then B then C?
Should they just assume the top ones are mutations and the last is a query?
Really its much of the same concerns I had on graphql/graphql-spec#375. I originally proposed this RFC but have not chased it up hard to try to get it in the spec as its a slow process. I am not sure that there will be a "spec" compliant "protocol" to be honest
We don't have an immediate use case for just executing multiple operations, except if it would make it easier for us to hack together an ad-hoc way to chain mutations with variables (something like the @export proposal). Also, we don't need to stream downstream responses, we would be ok with just waiting for all operations to finish to respond.
Bascially, we have designed our API in favor of small, composable mutations and queries, but clients are hesitant to eat the cost of 2-3 HTTP requests to get what they want.
Here's an example use case with actual mutations from our API:
Basically, you tokenize a credit card (exchange raw details for a single-use token), then use that single-use token to permanently store the payment method in the merchant's vault, then use the vaulted payment method ID to charge the payment method.
We support a large number of payment method types (credit card, apple pay, google pay, etc.), and would prefer to not have to create a mutation for each of tokenize, vault, and charge for each payment method in order to limit the surface area of our API.
Activity
bbakerman commentedon Oct 28, 2017
This is an example test that might pass with this mechanism
bbakerman commentedon Nov 2, 2017
I spoke to the lead of Sangria about there implementation and a couple of thigns stood out
First off the combined batching and @export as a featue.
When they have say 3 operations. A, B,C they applied a dependency resolution process to decide the order.
if they got a cyclic dep thet refuse the whole operation.
Otherwise thet worked out that it sould be B,C,A or A,C,B based on @exported variables
They streams the results out the other side.
This allows for an order of say B,C,A and B can finish first as an execution result, then C and then A.
This allows you to send back B as results, and then C and then A. In order words the story then comments then likes say??
alexgenco commentedon Dec 21, 2018
Just wanted to bump this thread. Any reason not to revive this? We definitely have use cases for performing multiple operations in a single request.
bbakerman commentedon Jan 8, 2019
@alexgenco - can you expand your use cases.
As for thoughts on this the real challenge is the "protocol" for returning results. Should they be combined? Should they feed into each other via "variables" and hence need dependency resolution?
Should the results be "streamed" much like subscription such that a client gets operation A, then B then C?
Should they just assume the top ones are mutations and the last is a query?
Really its much of the same concerns I had on graphql/graphql-spec#375. I originally proposed this RFC but have not chased it up hard to try to get it in the spec as its a slow process. I am not sure that there will be a "spec" compliant "protocol" to be honest
This is the blocking design challenge to me.
alexgenco commentedon Jan 8, 2019
We don't have an immediate use case for just executing multiple operations, except if it would make it easier for us to hack together an ad-hoc way to chain mutations with variables (something like the
@exportproposal). Also, we don't need to stream downstream responses, we would be ok with just waiting for all operations to finish to respond.Bascially, we have designed our API in favor of small, composable mutations and queries, but clients are hesitant to eat the cost of 2-3 HTTP requests to get what they want.
Here's an example use case with actual mutations from our API:
Basically, you tokenize a credit card (exchange raw details for a single-use token), then use that single-use token to permanently store the payment method in the merchant's vault, then use the vaulted payment method ID to charge the payment method.
We support a large number of payment method types (credit card, apple pay, google pay, etc.), and would prefer to not have to create a mutation for each of
tokenize,vault, andchargefor each payment method in order to limit the surface area of our API.andimarek commentedon Jul 19, 2019
closing this for now as multiple queries are not supported by the spec at the moment