From 4a830297decd3713018bd3316570de04eb9bf01e Mon Sep 17 00:00:00 2001 From: spetrunin Date: Tue, 22 Jul 2025 14:42:53 +0300 Subject: [PATCH] chore: add variables remapper to plan generator --- router/core/plan_generator.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/router/core/plan_generator.go b/router/core/plan_generator.go index 01e45ec915..27cc84a223 100644 --- a/router/core/plan_generator.go +++ b/router/core/plan_generator.go @@ -8,10 +8,6 @@ import ( "os" log "github.com/jensneuse/abstractlogger" - nodev1 "github.com/wundergraph/cosmo/router/gen/proto/wg/cosmo/node/v1" - "github.com/wundergraph/cosmo/router/pkg/config" - "github.com/wundergraph/cosmo/router/pkg/pubsub/kafka" - "github.com/wundergraph/cosmo/router/pkg/pubsub/nats" "github.com/wundergraph/graphql-go-tools/v2/pkg/ast" "github.com/wundergraph/graphql-go-tools/v2/pkg/astnormalization" "github.com/wundergraph/graphql-go-tools/v2/pkg/astparser" @@ -25,6 +21,11 @@ import ( "github.com/wundergraph/graphql-go-tools/v2/pkg/operationreport" "go.uber.org/zap" + nodev1 "github.com/wundergraph/cosmo/router/gen/proto/wg/cosmo/node/v1" + "github.com/wundergraph/cosmo/router/pkg/config" + "github.com/wundergraph/cosmo/router/pkg/pubsub/kafka" + "github.com/wundergraph/cosmo/router/pkg/pubsub/nats" + "github.com/wundergraph/cosmo/router/pkg/execution_config" ) @@ -125,7 +126,12 @@ func (pl *Planner) normalizeOperation(operation *ast.Document, operationName []b report := operationreport.Report{} astnormalization.NormalizeNamedOperation(operation, pl.definition, operationName, &report) + if report.HasErrors() { + return report + } + remapper := astnormalization.NewVariablesMapper() + remapper.NormalizeOperation(operation, pl.definition, &report) if report.HasErrors() { return report }