Skip to content
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

Batch request with one Operation and multiple queries #2278

Closed
mortzi opened this issue Sep 3, 2020 · 5 comments
Closed

Batch request with one Operation and multiple queries #2278

mortzi opened this issue Sep 3, 2020 · 5 comments

Comments

@mortzi
Copy link

mortzi commented Sep 3, 2020

As mentioned in Batching document, I understand that Hot Chocolate supports sending multiple Operations in a single HTTP Post request.

But does Hot Chocolate support executing multiple queries in a single Operation? like:

query {
  queryA {
    fieldA @export(as: "foo")
  }
  queryB (input: $foo) {
    fieldB
  }
}

However, I executed this query and I get an error saying: "Variable foo is not declared".
I am not sure if it's not supported or a bug.

Thanks guys

@michaelstaib
Copy link
Member

No, that is not allowed and would violate the spec. When doing it over HTTP we are preprocessing the queries to make them valid, but this query is getting straight to the GraphQL processor which marks them as invalid.

@michaelstaib michaelstaib added ❓ question This issue is a question about feature of Hot Chocolate. 🌶 hot chocolate labels Sep 6, 2020
@michaelstaib
Copy link
Member

Operation batching is the closest to what you ask here.

@mortzi
Copy link
Author

mortzi commented Sep 6, 2020

@michaelstaib Thanks. That's the answer I was looking for.
My problem was that my client supports multiple queries in one operation and not operation batching.
graphql/graphql-spec#375 related to what you mentioned.

@michaelstaib
Copy link
Member

The problem here is the export directive. Just having multiple root fields in one operation is possible, but each of them is independent from each other.

@michaelstaib
Copy link
Member

Closing this issue.

@michaelstaib michaelstaib removed the ❓ question This issue is a question about feature of Hot Chocolate. label Nov 26, 2024
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

No branches or pull requests

2 participants