diff --git a/_examples/chat/generated.go b/_examples/chat/generated.go index 18cc9fdee69..ed97c5beec8 100644 --- a/_examples/chat/generated.go +++ b/_examples/chat/generated.go @@ -203,12 +203,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -216,7 +216,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults @@ -246,7 +246,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, rc.Operation.SelectionSet) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) @@ -255,8 +255,8 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } } case ast.Subscription: - next := ec._subscriptionMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error) { - return ec._Subscription(ctx, rc.Operation.SelectionSet), nil + next := ec._subscriptionMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error) { + return ec._Subscription(ctx, opCtx.Operation.SelectionSet), nil }) var buf bytes.Buffer diff --git a/_examples/config/generated.go b/_examples/config/generated.go index b5b12d648b9..b2660fbbcf5 100644 --- a/_examples/config/generated.go +++ b/_examples/config/generated.go @@ -210,14 +210,14 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputNewTodo, ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -225,7 +225,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults @@ -255,7 +255,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, rc.Operation.SelectionSet) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) diff --git a/_examples/dataloader/generated.go b/_examples/dataloader/generated.go index 1f26b7a3ce1..797bdbc635d 100644 --- a/_examples/dataloader/generated.go +++ b/_examples/dataloader/generated.go @@ -231,12 +231,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -244,7 +244,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/_examples/embedding/subdir/gendir/generated.go b/_examples/embedding/subdir/gendir/generated.go index 91b85c97180..462a26f97cf 100644 --- a/_examples/embedding/subdir/gendir/generated.go +++ b/_examples/embedding/subdir/gendir/generated.go @@ -122,12 +122,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -135,7 +135,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/_examples/embedding/subdir/root_.generated.go b/_examples/embedding/subdir/root_.generated.go index d2dc848a054..0a8fa8ba799 100644 --- a/_examples/embedding/subdir/root_.generated.go +++ b/_examples/embedding/subdir/root_.generated.go @@ -112,12 +112,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -125,7 +125,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/_examples/enum/api/exec.go b/_examples/enum/api/exec.go index a097efee4ca..b5faef1f880 100644 --- a/_examples/enum/api/exec.go +++ b/_examples/enum/api/exec.go @@ -286,12 +286,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -299,7 +299,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/_examples/federation/accounts/graph/generated.go b/_examples/federation/accounts/graph/generated.go index bed5867a3dd..2bf01b4963b 100644 --- a/_examples/federation/accounts/graph/generated.go +++ b/_examples/federation/accounts/graph/generated.go @@ -211,12 +211,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -224,7 +224,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/_examples/federation/products/graph/generated.go b/_examples/federation/products/graph/generated.go index bc3167ae93d..d65f535f954 100644 --- a/_examples/federation/products/graph/generated.go +++ b/_examples/federation/products/graph/generated.go @@ -81,12 +81,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -94,7 +94,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/_examples/federation/reviews/graph/generated.go b/_examples/federation/reviews/graph/generated.go index 3230f51f355..fcc43caa025 100644 --- a/_examples/federation/reviews/graph/generated.go +++ b/_examples/federation/reviews/graph/generated.go @@ -110,14 +110,14 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputProductByManufacturerIDAndIDsInput, ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -125,7 +125,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/_examples/fileupload/generated.go b/_examples/fileupload/generated.go index 2f1f1685d62..2a80448a360 100644 --- a/_examples/fileupload/generated.go +++ b/_examples/fileupload/generated.go @@ -183,14 +183,14 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputUploadFile, ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -198,7 +198,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults @@ -228,7 +228,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, rc.Operation.SelectionSet) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) diff --git a/_examples/scalars/generated.go b/_examples/scalars/generated.go index bdb9e06fd65..efaf4148fc2 100644 --- a/_examples/scalars/generated.go +++ b/_examples/scalars/generated.go @@ -236,14 +236,14 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputSearchArgs, ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -251,7 +251,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/_examples/selection/generated.go b/_examples/selection/generated.go index 7eb8599d721..2380e52c4aa 100644 --- a/_examples/selection/generated.go +++ b/_examples/selection/generated.go @@ -156,12 +156,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -169,7 +169,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/_examples/selection/selection.go b/_examples/selection/selection.go index 6a6b0f9bec3..bcf5db0f504 100644 --- a/_examples/selection/selection.go +++ b/_examples/selection/selection.go @@ -23,7 +23,7 @@ type queryResolver struct{ *Resolver } func (r *queryResolver) Events(ctx context.Context) ([]Event, error) { var sels []string - reqCtx := graphql.GetOperationContext(ctx) + opCtx := graphql.GetOperationContext(ctx) fieldSelections := graphql.GetFieldContext(ctx).Field.Selections for _, sel := range fieldSelections { switch sel := sel.(type) { @@ -32,7 +32,7 @@ func (r *queryResolver) Events(ctx context.Context) ([]Event, error) { case *ast.InlineFragment: sels = append(sels, fmt.Sprintf("inline fragment on %s", sel.TypeCondition)) case *ast.FragmentSpread: - fragment := reqCtx.Doc.Fragments.ForName(sel.Name) + fragment := opCtx.Doc.Fragments.ForName(sel.Name) sels = append(sels, fmt.Sprintf("named fragment %s on %s", sel.Name, fragment.TypeCondition)) } } diff --git a/_examples/starwars/generated/exec.go b/_examples/starwars/generated/exec.go index f2528a9c312..357613597c3 100644 --- a/_examples/starwars/generated/exec.go +++ b/_examples/starwars/generated/exec.go @@ -513,14 +513,14 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputReviewInput, ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -528,7 +528,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults @@ -558,7 +558,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, rc.Operation.SelectionSet) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) diff --git a/_examples/todo/generated.go b/_examples/todo/generated.go index 755dfbd6249..0ff80352d40 100644 --- a/_examples/todo/generated.go +++ b/_examples/todo/generated.go @@ -171,14 +171,14 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputTodoInput, ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -186,8 +186,8 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._queryMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error) { - return ec._MyQuery(ctx, rc.Operation.SelectionSet), nil + data = ec._queryMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error) { + return ec._MyQuery(ctx, opCtx.Operation.SelectionSet), nil }) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { @@ -218,8 +218,8 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._mutationMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error) { - return ec._MyMutation(ctx, rc.Operation.SelectionSet), nil + data := ec._mutationMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error) { + return ec._MyMutation(ctx, opCtx.Operation.SelectionSet), nil }) var buf bytes.Buffer data.MarshalGQL(&buf) diff --git a/_examples/type-system-extension/generated.go b/_examples/type-system-extension/generated.go index f919ba26a5c..511aa235571 100644 --- a/_examples/type-system-extension/generated.go +++ b/_examples/type-system-extension/generated.go @@ -161,14 +161,14 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputTodoInput, ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -176,7 +176,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._MyQuery(ctx, rc.Operation.SelectionSet) + data = ec._MyQuery(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults @@ -206,7 +206,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._MyMutation(ctx, rc.Operation.SelectionSet) + data := ec._MyMutation(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) diff --git a/_examples/uuid/graph/generated.go b/_examples/uuid/graph/generated.go index 57b2c363a81..18af57b7f19 100644 --- a/_examples/uuid/graph/generated.go +++ b/_examples/uuid/graph/generated.go @@ -136,14 +136,14 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputNewTodo, ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -151,7 +151,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults @@ -181,7 +181,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, rc.Operation.SelectionSet) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) diff --git a/_examples/websocket-initfunc/server/graph/generated.go b/_examples/websocket-initfunc/server/graph/generated.go index db386d62c9f..f11ac45af2a 100644 --- a/_examples/websocket-initfunc/server/graph/generated.go +++ b/_examples/websocket-initfunc/server/graph/generated.go @@ -135,12 +135,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { if !first { @@ -148,7 +148,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Query(ctx, rc.Operation.SelectionSet) + data := ec._Query(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) @@ -163,7 +163,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, rc.Operation.SelectionSet) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) @@ -172,7 +172,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } } case ast.Subscription: - next := ec._Subscription(ctx, rc.Operation.SelectionSet) + next := ec._Subscription(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer return func(ctx context.Context) *graphql.Response { diff --git a/codegen/generated!.gotpl b/codegen/generated!.gotpl index 1e5bfbfc0f6..7f526a2174b 100644 --- a/codegen/generated!.gotpl +++ b/codegen/generated!.gotpl @@ -150,8 +150,8 @@ } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( {{- range $input := .Inputs -}} {{ if not $input.HasUnmarshal }} @@ -161,7 +161,7 @@ ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { {{- if .QueryRoot }} case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -170,11 +170,11 @@ first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) {{ if .Directives.LocationDirectives "QUERY" -}} - data = ec._queryMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet), nil + data = ec._queryMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return ec._{{.QueryRoot.Name}}(ctx, opCtx.Operation.SelectionSet), nil }) {{- else -}} - data = ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet) + data = ec._{{.QueryRoot.Name}}(ctx, opCtx.Operation.SelectionSet) {{- end }} } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { @@ -206,11 +206,11 @@ first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) {{ if .Directives.LocationDirectives "MUTATION" -}} - data := ec._mutationMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet), nil + data := ec._mutationMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return ec._{{.MutationRoot.Name}}(ctx, opCtx.Operation.SelectionSet), nil }) {{- else -}} - data := ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet) + data := ec._{{.MutationRoot.Name}}(ctx, opCtx.Operation.SelectionSet) {{- end }} var buf bytes.Buffer data.MarshalGQL(&buf) @@ -223,11 +223,11 @@ {{- if .SubscriptionRoot }} case ast.Subscription: {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}} - next := ec._subscriptionMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet),nil + next := ec._subscriptionMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return ec._{{.SubscriptionRoot.Name}}(ctx, opCtx.Operation.SelectionSet),nil }) {{- else -}} - next := ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet) + next := ec._{{.SubscriptionRoot.Name}}(ctx, opCtx.Operation.SelectionSet) {{- end }} var buf bytes.Buffer diff --git a/codegen/root_.gotpl b/codegen/root_.gotpl index d392ef53eca..91882647f9a 100644 --- a/codegen/root_.gotpl +++ b/codegen/root_.gotpl @@ -123,8 +123,8 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( {{- range $input := .Inputs -}} {{ if not $input.HasUnmarshal }} @@ -134,7 +134,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { {{- if .QueryRoot }} case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -143,11 +143,11 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) {{ if .Directives.LocationDirectives "QUERY" -}} - data = ec._queryMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet), nil + data = ec._queryMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return ec._{{.QueryRoot.Name}}(ctx, opCtx.Operation.SelectionSet), nil }) {{- else -}} - data = ec._{{.QueryRoot.Name}}(ctx, rc.Operation.SelectionSet) + data = ec._{{.QueryRoot.Name}}(ctx, opCtx.Operation.SelectionSet) {{- end }} } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { @@ -179,11 +179,11 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) {{ if .Directives.LocationDirectives "MUTATION" -}} - data := ec._mutationMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet), nil + data := ec._mutationMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return ec._{{.MutationRoot.Name}}(ctx, opCtx.Operation.SelectionSet), nil }) {{- else -}} - data := ec._{{.MutationRoot.Name}}(ctx, rc.Operation.SelectionSet) + data := ec._{{.MutationRoot.Name}}(ctx, opCtx.Operation.SelectionSet) {{- end }} var buf bytes.Buffer data.MarshalGQL(&buf) @@ -196,11 +196,11 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { {{- if .SubscriptionRoot }} case ast.Subscription: {{ if .Directives.LocationDirectives "SUBSCRIPTION" -}} - next := ec._subscriptionMiddleware(ctx, rc.Operation, func(ctx context.Context) (interface{}, error){ - return ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet),nil + next := ec._subscriptionMiddleware(ctx, opCtx.Operation, func(ctx context.Context) (interface{}, error){ + return ec._{{.SubscriptionRoot.Name}}(ctx, opCtx.Operation.SelectionSet),nil }) {{- else -}} - next := ec._{{.SubscriptionRoot.Name}}(ctx, rc.Operation.SelectionSet) + next := ec._{{.SubscriptionRoot.Name}}(ctx, opCtx.Operation.SelectionSet) {{- end }} var buf bytes.Buffer diff --git a/codegen/testserver/followschema/root_.generated.go b/codegen/testserver/followschema/root_.generated.go index b4fafbc1d57..deb06db4a61 100644 --- a/codegen/testserver/followschema/root_.generated.go +++ b/codegen/testserver/followschema/root_.generated.go @@ -2156,8 +2156,8 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputChanges, ec.unmarshalInputDefaultInput, @@ -2180,7 +2180,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -2188,7 +2188,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults @@ -2218,7 +2218,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, rc.Operation.SelectionSet) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) @@ -2227,7 +2227,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } } case ast.Subscription: - next := ec._Subscription(ctx, rc.Operation.SelectionSet) + next := ec._Subscription(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer return func(ctx context.Context) *graphql.Response { diff --git a/codegen/testserver/nullabledirectives/generated/root_.generated.go b/codegen/testserver/nullabledirectives/generated/root_.generated.go index 717c9030bfd..8525f5578a1 100644 --- a/codegen/testserver/nullabledirectives/generated/root_.generated.go +++ b/codegen/testserver/nullabledirectives/generated/root_.generated.go @@ -82,12 +82,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -95,7 +95,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/codegen/testserver/singlefile/generated.go b/codegen/testserver/singlefile/generated.go index 6c217eb55c0..ca8bafbae07 100644 --- a/codegen/testserver/singlefile/generated.go +++ b/codegen/testserver/singlefile/generated.go @@ -2309,8 +2309,8 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputChanges, ec.unmarshalInputDefaultInput, @@ -2333,7 +2333,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -2341,7 +2341,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults @@ -2371,7 +2371,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Mutation(ctx, rc.Operation.SelectionSet) + data := ec._Mutation(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf) @@ -2380,7 +2380,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } } case ast.Subscription: - next := ec._Subscription(ctx, rc.Operation.SelectionSet) + next := ec._Subscription(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer return func(ctx context.Context) *graphql.Response { diff --git a/graphql/context_field.go b/graphql/context_field.go index b3fab91017c..0fef085523e 100644 --- a/graphql/context_field.go +++ b/graphql/context_field.go @@ -36,14 +36,14 @@ type FieldContext struct { // // srv.AroundFields(func(ctx context.Context, next graphql.Resolver) (interface{}, error) { // fc := graphql.GetFieldContext(ctx) - // op := graphql.GetOperationContext(ctx) + // opCtx := graphql.GetOperationContext(ctx) // collected := graphql.CollectFields(opCtx, fc.Field.Selections, []string{"User"}) // // child, err := fc.Child(ctx, collected[0]) // if err != nil { // return nil, err // } - // fmt.Println("child context %q with args: %v", child.Field.Name, child.Args) + // fmt.Printf("child context %q with args: %v\n", child.Field.Name, child.Args) // // return next(ctx) // }) diff --git a/graphql/context_operation.go b/graphql/context_operation.go index d515acce184..f762628124f 100644 --- a/graphql/context_operation.go +++ b/graphql/context_operation.go @@ -65,8 +65,8 @@ func GetOperationContext(ctx context.Context) *OperationContext { panic("missing operation context") } -func WithOperationContext(ctx context.Context, rc *OperationContext) context.Context { - return context.WithValue(ctx, operationCtx, rc) +func WithOperationContext(ctx context.Context, opCtx *OperationContext) context.Context { + return context.WithValue(ctx, operationCtx, opCtx) } // HasOperationContext checks if the given context is part of an ongoing operation diff --git a/graphql/context_operation_test.go b/graphql/context_operation_test.go index df2e38dfbe8..45e3c5c5117 100644 --- a/graphql/context_operation_test.go +++ b/graphql/context_operation_test.go @@ -31,13 +31,13 @@ func (t *testGraphRequestContext) Value(key any) any { } func TestGetOperationContext(t *testing.T) { - rc := &OperationContext{} + opCtx := &OperationContext{} t.Run("with operation context", func(t *testing.T) { - ctx := WithOperationContext(context.Background(), rc) + ctx := WithOperationContext(context.Background(), opCtx) require.True(t, HasOperationContext(ctx)) - require.Equal(t, rc, GetOperationContext(ctx)) + require.Equal(t, opCtx, GetOperationContext(ctx)) }) t.Run("without operation context", func(t *testing.T) { diff --git a/graphql/executor/executor.go b/graphql/executor/executor.go index 9c8de3efcc0..c0f0721c151 100644 --- a/graphql/executor/executor.go +++ b/graphql/executor/executor.go @@ -47,7 +47,7 @@ func (e *Executor) CreateOperationContext( ctx context.Context, params *graphql.RawParams, ) (*graphql.OperationContext, gqlerror.List) { - rc := &graphql.OperationContext{ + opCtx := &graphql.OperationContext{ DisableIntrospection: true, RecoverFunc: e.recoverFunc, ResolverMiddleware: e.ext.fieldMiddleware, @@ -57,56 +57,56 @@ func (e *Executor) CreateOperationContext( OperationStart: graphql.GetStartTime(ctx), }, } - ctx = graphql.WithOperationContext(ctx, rc) + ctx = graphql.WithOperationContext(ctx, opCtx) for _, p := range e.ext.operationParameterMutators { if err := p.MutateOperationParameters(ctx, params); err != nil { - return rc, gqlerror.List{err} + return opCtx, gqlerror.List{err} } } - rc.RawQuery = params.Query - rc.OperationName = params.OperationName - rc.Headers = params.Headers + opCtx.RawQuery = params.Query + opCtx.OperationName = params.OperationName + opCtx.Headers = params.Headers var listErr gqlerror.List - rc.Doc, listErr = e.parseQuery(ctx, &rc.Stats, params.Query) + opCtx.Doc, listErr = e.parseQuery(ctx, &opCtx.Stats, params.Query) if len(listErr) != 0 { - return rc, listErr + return opCtx, listErr } - rc.Operation = rc.Doc.Operations.ForName(params.OperationName) - if rc.Operation == nil { + opCtx.Operation = opCtx.Doc.Operations.ForName(params.OperationName) + if opCtx.Operation == nil { err := gqlerror.Errorf("operation %s not found", params.OperationName) errcode.Set(err, errcode.ValidationFailed) - return rc, gqlerror.List{err} + return opCtx, gqlerror.List{err} } var err error - rc.Variables, err = validator.VariableValues(e.es.Schema(), rc.Operation, params.Variables) + opCtx.Variables, err = validator.VariableValues(e.es.Schema(), opCtx.Operation, params.Variables) if err != nil { gqlErr, ok := err.(*gqlerror.Error) if ok { errcode.Set(gqlErr, errcode.ValidationFailed) - return rc, gqlerror.List{gqlErr} + return opCtx, gqlerror.List{gqlErr} } } - rc.Stats.Validation.End = graphql.Now() + opCtx.Stats.Validation.End = graphql.Now() for _, p := range e.ext.operationContextMutators { - if err := p.MutateOperationContext(ctx, rc); err != nil { - return rc, gqlerror.List{err} + if err := p.MutateOperationContext(ctx, opCtx); err != nil { + return opCtx, gqlerror.List{err} } } - return rc, nil + return opCtx, nil } func (e *Executor) DispatchOperation( ctx context.Context, - rc *graphql.OperationContext, + opCtx *graphql.OperationContext, ) (graphql.ResponseHandler, context.Context) { - ctx = graphql.WithOperationContext(ctx, rc) + ctx = graphql.WithOperationContext(ctx, opCtx) var innerCtx context.Context res := e.ext.operationMiddleware(ctx, func(ctx context.Context) graphql.ResponseHandler { diff --git a/graphql/executor/executor_test.go b/graphql/executor/executor_test.go index d32a340fdbd..b8e87852aa0 100644 --- a/graphql/executor/executor_test.go +++ b/graphql/executor/executor_test.go @@ -112,7 +112,7 @@ func TestExecutor(t *testing.T) { }, }) exec.Use(&testCtxMutator{ - Mutate: func(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { + Mutate: func(ctx context.Context, opCtx *graphql.OperationContext) *gqlerror.Error { calls = append(calls, "context") return nil }, @@ -197,8 +197,8 @@ func (m *testCtxMutator) Validate(s graphql.ExecutableSchema) error { return nil } -func (m *testCtxMutator) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { - return m.Mutate(ctx, rc) +func (m *testCtxMutator) MutateOperationContext(ctx context.Context, opCtx *graphql.OperationContext) *gqlerror.Error { + return m.Mutate(ctx, opCtx) } func TestErrorServer(t *testing.T) { diff --git a/graphql/executor/testexecutor/testexecutor.go b/graphql/executor/testexecutor/testexecutor.go index 55778a22f1b..e086a4876a1 100644 --- a/graphql/executor/testexecutor/testexecutor.go +++ b/graphql/executor/testexecutor/testexecutor.go @@ -60,8 +60,8 @@ func New() *TestExecutor { exec.schema = &graphql.ExecutableSchemaMock{ ExecFunc: func(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - switch rc.Operation.Operation { + opCtx := graphql.GetOperationContext(ctx) + switch opCtx.Operation.Operation { case ast.Query: ran := false return func(ctx context.Context) *graphql.Response { @@ -143,8 +143,8 @@ func NewError() *TestExecutor { exec.schema = &graphql.ExecutableSchemaMock{ ExecFunc: func(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - switch rc.Operation.Operation { + opCtx := graphql.GetOperationContext(ctx) + switch opCtx.Operation.Operation { case ast.Query: ran := false return func(ctx context.Context) *graphql.Response { diff --git a/graphql/handler.go b/graphql/handler.go index 4df36117b8e..ab2ed4b640a 100644 --- a/graphql/handler.go +++ b/graphql/handler.go @@ -34,7 +34,7 @@ type ( GraphExecutor interface { CreateOperationContext(ctx context.Context, params *RawParams) (*OperationContext, gqlerror.List) - DispatchOperation(ctx context.Context, rc *OperationContext) (ResponseHandler, context.Context) + DispatchOperation(ctx context.Context, opCtx *OperationContext) (ResponseHandler, context.Context) DispatchError(ctx context.Context, list gqlerror.List) *Response } @@ -65,7 +65,7 @@ type ( // OperationContextMutator is called after creating the request context, but before executing the root resolver. OperationContextMutator interface { - MutateOperationContext(ctx context.Context, rc *OperationContext) *gqlerror.Error + MutateOperationContext(ctx context.Context, opCtx *OperationContext) *gqlerror.Error } // OperationInterceptor is called for each incoming query, for basic requests the writer will be invoked once, diff --git a/graphql/handler/apollofederatedtracingv1/tree_builder.go b/graphql/handler/apollofederatedtracingv1/tree_builder.go index 8953ae12389..4f7172036de 100644 --- a/graphql/handler/apollofederatedtracingv1/tree_builder.go +++ b/graphql/handler/apollofederatedtracingv1/tree_builder.go @@ -54,8 +54,8 @@ func (tb *TreeBuilder) StartTimer(ctx context.Context) { fmt.Println(errors.New("StartTimer called after StopTimer")) } - rc := graphql.GetOperationContext(ctx) - start := rc.Stats.OperationStart + opCtx := graphql.GetOperationContext(ctx) + start := opCtx.Stats.OperationStart tb.Trace.StartTime = timestamppb.New(start) tb.startTime = &start diff --git a/graphql/handler/apollotracing/tracer.go b/graphql/handler/apollotracing/tracer.go index a1d640749de..8e21aba0b3d 100644 --- a/graphql/handler/apollotracing/tracer.go +++ b/graphql/handler/apollotracing/tracer.go @@ -66,14 +66,14 @@ func (Tracer) InterceptField(ctx context.Context, next graphql.Resolver) (any, e defer func() { end := graphql.Now() - rc := graphql.GetOperationContext(ctx) + opCtx := graphql.GetOperationContext(ctx) fc := graphql.GetFieldContext(ctx) resolver := &ResolverExecution{ Path: fc.Path(), ParentType: fc.Object, FieldName: fc.Field.Name, ReturnType: fc.Field.Definition.Type.String(), - StartOffset: start.Sub(rc.Stats.OperationStart), + StartOffset: start.Sub(opCtx.Stats.OperationStart), Duration: end.Sub(start), } @@ -90,21 +90,21 @@ func (Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandle return next(ctx) } - rc := graphql.GetOperationContext(ctx) + opCtx := graphql.GetOperationContext(ctx) - start := rc.Stats.OperationStart + start := opCtx.Stats.OperationStart td := &TracingExtension{ Version: 1, StartTime: start, Parsing: Span{ - StartOffset: rc.Stats.Parsing.Start.Sub(start), - Duration: rc.Stats.Parsing.End.Sub(rc.Stats.Parsing.Start), + StartOffset: opCtx.Stats.Parsing.Start.Sub(start), + Duration: opCtx.Stats.Parsing.End.Sub(opCtx.Stats.Parsing.Start), }, Validation: Span{ - StartOffset: rc.Stats.Validation.Start.Sub(start), - Duration: rc.Stats.Validation.End.Sub(rc.Stats.Validation.Start), + StartOffset: opCtx.Stats.Validation.Start.Sub(start), + Duration: opCtx.Stats.Validation.End.Sub(opCtx.Stats.Validation.Start), }, } diff --git a/graphql/handler/debug/tracer.go b/graphql/handler/debug/tracer.go index 1fc574e39b6..5c75565c66d 100644 --- a/graphql/handler/debug/tracer.go +++ b/graphql/handler/debug/tracer.go @@ -49,13 +49,13 @@ func stringify(value any) string { } func (a Tracer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response { - rctx := graphql.GetOperationContext(ctx) + opCtx := graphql.GetOperationContext(ctx) _, _ = fmt.Fprintln(a.out, "GraphQL Request {") - for _, line := range strings.Split(rctx.RawQuery, "\n") { + for _, line := range strings.Split(opCtx.RawQuery, "\n") { _, _ = fmt.Fprintln(a.out, " ", aurora.Cyan(line)) } - for name, value := range rctx.Variables { + for name, value := range opCtx.Variables { _, _ = fmt.Fprintf(a.out, " var %s = %s\n", name, aurora.Yellow(stringify(value))) } resp := next(ctx) diff --git a/graphql/handler/extension/apq.go b/graphql/handler/extension/apq.go index 6944bbffab8..9390c4feae0 100644 --- a/graphql/handler/extension/apq.go +++ b/graphql/handler/extension/apq.go @@ -98,12 +98,12 @@ func (a AutomaticPersistedQuery) MutateOperationParameters(ctx context.Context, } func GetApqStats(ctx context.Context) *ApqStats { - rc := graphql.GetOperationContext(ctx) - if rc == nil { + opCtx := graphql.GetOperationContext(ctx) + if opCtx == nil { return nil } - s, _ := rc.Stats.GetExtension(apqExtension).(*ApqStats) + s, _ := opCtx.Stats.GetExtension(apqExtension).(*ApqStats) return s } diff --git a/graphql/handler/extension/complexity.go b/graphql/handler/extension/complexity.go index af1e002fc11..3684f078602 100644 --- a/graphql/handler/extension/complexity.go +++ b/graphql/handler/extension/complexity.go @@ -17,7 +17,7 @@ const errComplexityLimit = "COMPLEXITY_LIMIT_EXCEEDED" // // If a query is submitted that exceeds the limit, a 422 status code will be returned. type ComplexityLimit struct { - Func func(ctx context.Context, rc *graphql.OperationContext) int + Func func(ctx context.Context, opCtx *graphql.OperationContext) int es graphql.ExecutableSchema } @@ -40,7 +40,7 @@ type ComplexityStats struct { // FixedComplexityLimit sets a complexity limit that does not change func FixedComplexityLimit(limit int) *ComplexityLimit { return &ComplexityLimit{ - Func: func(ctx context.Context, rc *graphql.OperationContext) int { + Func: func(ctx context.Context, opCtx *graphql.OperationContext) int { return limit }, } @@ -58,13 +58,13 @@ func (c *ComplexityLimit) Validate(schema graphql.ExecutableSchema) error { return nil } -func (c ComplexityLimit) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { - op := rc.Doc.Operations.ForName(rc.OperationName) - complexityCalcs := complexity.Calculate(c.es, op, rc.Variables) +func (c ComplexityLimit) MutateOperationContext(ctx context.Context, opCtx *graphql.OperationContext) *gqlerror.Error { + op := opCtx.Doc.Operations.ForName(opCtx.OperationName) + complexityCalcs := complexity.Calculate(c.es, op, opCtx.Variables) - limit := c.Func(ctx, rc) + limit := c.Func(ctx, opCtx) - rc.Stats.SetExtension(complexityExtension, &ComplexityStats{ + opCtx.Stats.SetExtension(complexityExtension, &ComplexityStats{ Complexity: complexityCalcs, ComplexityLimit: limit, }) @@ -79,11 +79,11 @@ func (c ComplexityLimit) MutateOperationContext(ctx context.Context, rc *graphql } func GetComplexityStats(ctx context.Context) *ComplexityStats { - rc := graphql.GetOperationContext(ctx) - if rc == nil { + opCtx := graphql.GetOperationContext(ctx) + if opCtx == nil { return nil } - s, _ := rc.Stats.GetExtension(complexityExtension).(*ComplexityStats) + s, _ := opCtx.Stats.GetExtension(complexityExtension).(*ComplexityStats) return s } diff --git a/graphql/handler/extension/complexity_test.go b/graphql/handler/extension/complexity_test.go index d585ec7fdec..3b3ff89de09 100644 --- a/graphql/handler/extension/complexity_test.go +++ b/graphql/handler/extension/complexity_test.go @@ -18,8 +18,8 @@ import ( func TestHandlerComplexity(t *testing.T) { h := testserver.New() h.Use(&extension.ComplexityLimit{ - Func: func(ctx context.Context, rc *graphql.OperationContext) int { - if rc.RawQuery == "{ ok: name }" { + Func: func(ctx context.Context, opCtx *graphql.OperationContext) int { + if opCtx.RawQuery == "{ ok: name }" { return 4 } return 2 diff --git a/graphql/handler/extension/introspection.go b/graphql/handler/extension/introspection.go index 8e3912651d7..bdf0fdf87c4 100644 --- a/graphql/handler/extension/introspection.go +++ b/graphql/handler/extension/introspection.go @@ -24,7 +24,7 @@ func (c Introspection) Validate(schema graphql.ExecutableSchema) error { return nil } -func (c Introspection) MutateOperationContext(ctx context.Context, rc *graphql.OperationContext) *gqlerror.Error { - rc.DisableIntrospection = false +func (c Introspection) MutateOperationContext(ctx context.Context, opCtx *graphql.OperationContext) *gqlerror.Error { + opCtx.DisableIntrospection = false return nil } diff --git a/graphql/handler/extension/introspection_test.go b/graphql/handler/extension/introspection_test.go index c20904299f9..f619b4b4c36 100644 --- a/graphql/handler/extension/introspection_test.go +++ b/graphql/handler/extension/introspection_test.go @@ -11,10 +11,10 @@ import ( ) func TestIntrospection(t *testing.T) { - rc := &graphql.OperationContext{ + opCtx := &graphql.OperationContext{ DisableIntrospection: true, } - err := Introspection{}.MutateOperationContext(context.Background(), rc) + err := Introspection{}.MutateOperationContext(context.Background(), opCtx) require.Equal(t, (*gqlerror.Error)(nil), err) - require.False(t, rc.DisableIntrospection) + require.False(t, opCtx.DisableIntrospection) } diff --git a/graphql/handler/testserver/testserver.go b/graphql/handler/testserver/testserver.go index 9cd6eeb7a5c..c648c7ed8f9 100644 --- a/graphql/handler/testserver/testserver.go +++ b/graphql/handler/testserver/testserver.go @@ -40,12 +40,12 @@ func New() *TestServer { srv.Server = handler.New(&graphql.ExecutableSchemaMock{ ExecFunc: func(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - switch rc.Operation.Operation { + opCtx := graphql.GetOperationContext(ctx) + switch opCtx.Operation.Operation { case ast.Query: ran := false // If the query contains @defer, we will mimick a deferred response. - if strings.Contains(rc.RawQuery, "@defer") { + if strings.Contains(opCtx.RawQuery, "@defer") { initialResponse := true return func(context context.Context) *graphql.Response { select { @@ -141,8 +141,8 @@ func NewError() *TestServer { srv.Server = handler.New(&graphql.ExecutableSchemaMock{ ExecFunc: func(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - switch rc.Operation.Operation { + opCtx := graphql.GetOperationContext(ctx) + switch opCtx.Operation.Operation { case ast.Query: ran := false return func(ctx context.Context) *graphql.Response { diff --git a/graphql/handler/transport/http_get.go b/graphql/handler/transport/http_get.go index 470a0fbec29..09f1020d03c 100644 --- a/graphql/handler/transport/http_get.go +++ b/graphql/handler/transport/http_get.go @@ -66,21 +66,21 @@ func (h GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecut raw.ReadTime.End = graphql.Now() - rc, gqlError := exec.CreateOperationContext(r.Context(), raw) + opCtx, gqlError := exec.CreateOperationContext(r.Context(), raw) if gqlError != nil { w.WriteHeader(statusFor(gqlError)) - resp := exec.DispatchError(graphql.WithOperationContext(r.Context(), rc), gqlError) + resp := exec.DispatchError(graphql.WithOperationContext(r.Context(), opCtx), gqlError) writeJson(w, resp) return } - op := rc.Doc.Operations.ForName(rc.OperationName) + op := opCtx.Doc.Operations.ForName(opCtx.OperationName) if op.Operation != ast.Query { w.WriteHeader(http.StatusNotAcceptable) writeJsonError(w, "GET requests only allow query operations") return } - responses, ctx := exec.DispatchOperation(r.Context(), rc) + responses, ctx := exec.DispatchOperation(r.Context(), opCtx) writeJson(w, responses(ctx)) } diff --git a/handler/handler.go b/handler/handler.go index 30c77f8d68c..e07d10b30b8 100644 --- a/handler/handler.go +++ b/handler/handler.go @@ -60,8 +60,8 @@ func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc srv.Use(extension.FixedComplexityLimit(cfg.complexityLimit)) } else if cfg.complexityLimitFunc != nil { srv.Use(&extension.ComplexityLimit{ - Func: func(ctx context.Context, rc *graphql.OperationContext) int { - return cfg.complexityLimitFunc(graphql.WithOperationContext(ctx, rc)) + Func: func(ctx context.Context, opCtx *graphql.OperationContext) int { + return cfg.complexityLimitFunc(graphql.WithOperationContext(ctx, opCtx)) }, }) } diff --git a/integration/server/generated.go b/integration/server/generated.go index c8a4e4c756a..54aa9c9b0ff 100644 --- a/integration/server/generated.go +++ b/integration/server/generated.go @@ -257,15 +257,15 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputDateFilter, ec.unmarshalInputListCoercion, ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -273,7 +273,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/plugin/federation/testdata/computedrequires/generated/exec.go b/plugin/federation/testdata/computedrequires/generated/exec.go index 1ca93f41773..5becb497870 100644 --- a/plugin/federation/testdata/computedrequires/generated/exec.go +++ b/plugin/federation/testdata/computedrequires/generated/exec.go @@ -147,8 +147,8 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputMultiHelloByNamesInput, ec.unmarshalInputMultiHelloMultipleRequiresByNamesInput, @@ -158,7 +158,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -166,7 +166,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/plugin/federation/testdata/entityinterfaces/generated/exec.go b/plugin/federation/testdata/entityinterfaces/generated/exec.go index c5e20b8c82d..d2cf1aceeeb 100644 --- a/plugin/federation/testdata/entityinterfaces/generated/exec.go +++ b/plugin/federation/testdata/entityinterfaces/generated/exec.go @@ -158,12 +158,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -171,7 +171,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults @@ -277,7 +277,7 @@ type World implements Hello @key(fields: "id") { directive @override(from: String!) on FIELD_DEFINITION directive @provides(fields: FieldSet!) on FIELD_DEFINITION directive @requires(fields: FieldSet!) on FIELD_DEFINITION - directive @requiresScopes(scopes: [[federation__Scope!]!]!) on + directive @requiresScopes(scopes: [[federation__Scope!]!]!) on | FIELD_DEFINITION | OBJECT | INTERFACE diff --git a/plugin/federation/testdata/entityresolver/generated/exec.go b/plugin/federation/testdata/entityresolver/generated/exec.go index 262099f7af4..7fc332824f3 100644 --- a/plugin/federation/testdata/entityresolver/generated/exec.go +++ b/plugin/federation/testdata/entityresolver/generated/exec.go @@ -636,8 +636,8 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputMultiHelloByNamesInput, ec.unmarshalInputMultiHelloMultipleRequiresByNamesInput, @@ -647,7 +647,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -655,7 +655,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/plugin/federation/testdata/explicitrequires/generated/exec.go b/plugin/federation/testdata/explicitrequires/generated/exec.go index 9e3f9a48d94..a85e9fdeef1 100644 --- a/plugin/federation/testdata/explicitrequires/generated/exec.go +++ b/plugin/federation/testdata/explicitrequires/generated/exec.go @@ -88,8 +88,8 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e, 0, 0, make(chan graphql.DeferredResult)} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e, 0, 0, make(chan graphql.DeferredResult)} inputUnmarshalMap := graphql.BuildUnmarshalerMap( ec.unmarshalInputMultiHelloByNamesInput, ec.unmarshalInputMultiHelloMultipleRequiresByNamesInput, @@ -99,7 +99,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { ) first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { var response graphql.Response @@ -107,7 +107,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { if first { first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data = ec._Query(ctx, rc.Operation.SelectionSet) + data = ec._Query(ctx, opCtx.Operation.SelectionSet) } else { if atomic.LoadInt32(&ec.pendingDeferred) > 0 { result := <-ec.deferredResults diff --git a/plugin/resolvergen/testdata/return_values/ignored.go b/plugin/resolvergen/testdata/return_values/ignored.go index d7a1fcfba1d..59bdda651a0 100644 --- a/plugin/resolvergen/testdata/return_values/ignored.go +++ b/plugin/resolvergen/testdata/return_values/ignored.go @@ -107,12 +107,12 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in } func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { - rc := graphql.GetOperationContext(ctx) - ec := executionContext{rc, e} + opCtx := graphql.GetOperationContext(ctx) + ec := executionContext{opCtx, e} inputUnmarshalMap := graphql.BuildUnmarshalerMap() first := true - switch rc.Operation.Operation { + switch opCtx.Operation.Operation { case ast.Query: return func(ctx context.Context) *graphql.Response { if !first { @@ -120,7 +120,7 @@ func (e *executableSchema) Exec(ctx context.Context) graphql.ResponseHandler { } first = false ctx = graphql.WithUnmarshalerMap(ctx, inputUnmarshalMap) - data := ec._Query(ctx, rc.Operation.SelectionSet) + data := ec._Query(ctx, opCtx.Operation.SelectionSet) var buf bytes.Buffer data.MarshalGQL(&buf)