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:
|
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