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

When multiple operations are passed in query, wrong operation is taken and the operationName is ignored #217

Open
upcFrost opened this issue Sep 20, 2024 · 1 comment

Comments

@upcFrost
Copy link

When working with multiple operations in one query (happens a lot when using browser-based gql clients for testing), the gateway responds with error adding scrub fields: could not find field for point. After a closer look, the targetSelection in the generateScrubFieldsWalk method contains only the first operation out of all present in the query.

The spec suggests that the operation should be taken by name: https://spec.graphql.org/October2021/#sec-Executing-Requests

The culprit is most likely the array selector here:

gateway/plan.go

Line 115 in 0ac544a

flatSelection, err := graphql.ApplyFragments(parsedQuery.Operations[0].SelectionSet, parsedQuery.Fragments)

the operationName should be passed in the PlanningContext in GetPlans and then used to select the correct operation

@JohnStarich
Copy link
Member

Thanks for opening! I’ll take a look to see if I can reproduce.

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