Skip to content

Support for Batching #695

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

Closed
michaelstaib opened this issue Apr 23, 2019 · 3 comments · Fixed by #933
Closed

Support for Batching #695

michaelstaib opened this issue Apr 23, 2019 · 3 comments · Fixed by #933
Assignees
Milestone

Comments

@michaelstaib
Copy link
Member

michaelstaib commented Apr 23, 2019

[
  {
    query: `
      mutation ($input: TokenizeCreditCardInput!) {
        tokenizeCreditCard(input: $input) {
          paymentMethod {
            id @export(as: "id")
          }
        }
      }
    `,
    variables: { input: "..." }
  },
  {
    query: `
      mutation ($id: ID, $transaction: TransactionInput!) {
        chargePaymentMethod(input: { id: $id, transaction: $transaction }) {
          transaction {
            id
            status
          }
        }
      }
    `,
    variables: { transaction: "..." }
  },
]

https://github.com/apollographql/apollo-link/tree/master/packages/apollo-link-batch-http
https://blog.apollographql.com/batching-client-graphql-queries-a685f5bcd41b
https://sangria-graphql.org/learn/#batch-executor

@michaelstaib michaelstaib added this to the 9.0.0 milestone Apr 23, 2019
@michaelstaib michaelstaib added the 🔍 investigate Indicates that an issue or pull request needs more information. label Apr 25, 2019
@michaelstaib michaelstaib self-assigned this May 15, 2019
@michaelstaib michaelstaib modified the milestones: 9.0.0, 9.1.0 May 20, 2019
@michaelstaib michaelstaib added design and removed 🔍 investigate Indicates that an issue or pull request needs more information. labels May 26, 2019
@michaelstaib
Copy link
Member Author

graphql/graphql-spec#377

@michaelstaib
Copy link
Member Author

michaelstaib commented Jul 20, 2019

In order to support this we should introduce a new IBatchQueryExecutor that yields always a response stream on execute.

public interface IBatchQueryExecutor
{
    Task<IResponseStream> ExecuteAsync(IReadOnlyBatchQueryRequest request, CancellationToken cancellationToken);
}

@michaelstaib
Copy link
Member Author

@export(as: "foo")

The export directive can export a field result as variable under the same name as the field name or under a name specified by the as argument.

The exported variables are pushed to a list.

When a query is executed the batch executer will analyze if the query has all variables declared, if there are variables collected from a previous query that are not declared then the variable will be inferred from the argument/field in which they are used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant