Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions demo/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ require (
github.com/rs/cors v1.11.0
github.com/vektah/gqlparser/v2 v2.5.16
github.com/wundergraph/cosmo/composition-go v0.0.0-20240124120900-5effe48a4a1d
github.com/wundergraph/cosmo/router v0.0.0-20250107115408-cdd3d47d6424
github.com/wundergraph/cosmo/router v0.0.0-20250119174948-4b991294658e
github.com/wundergraph/cosmo/router-tests v0.0.0-20241213115435-a249dba8c52a
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.138.0.20250106145350-20e4f82cea6b
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.141
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.23.1
Expand Down
8 changes: 4 additions & 4 deletions demo/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -305,12 +305,12 @@ github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083 h1:8/D7f8gKxTB
github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083/go.mod h1:eOTL6acwctsN4F3b7YE+eE2t8zcJ/doLm9sZzsxxxrE=
github.com/wundergraph/cosmo/composition-go v0.0.0-20240124120900-5effe48a4a1d h1:NEUrhuqOaTO1dpW8pz2tu6dKbQAqFvgiF/m4NXdzZm0=
github.com/wundergraph/cosmo/composition-go v0.0.0-20240124120900-5effe48a4a1d/go.mod h1:9I3gPMAlAY+m1/cFL20iN7XHTyuZd3VT5ijccdU/FsI=
github.com/wundergraph/cosmo/router v0.0.0-20250107115408-cdd3d47d6424 h1:X+gTrBNOXyS1b6PjOs7iJspQiBpxqlmX91PpDL5qdgw=
github.com/wundergraph/cosmo/router v0.0.0-20250107115408-cdd3d47d6424/go.mod h1:XR62DDeHO2/vGppFRFlLGB2qLIViiUu1zg9vmYOo87M=
github.com/wundergraph/cosmo/router v0.0.0-20250119174948-4b991294658e h1:ee4fu7klTY98Zsz7kcYiowiK1RBJkwUBLK6KUo250p8=
github.com/wundergraph/cosmo/router v0.0.0-20250119174948-4b991294658e/go.mod h1:ImqCvxvvNOy1UxbuTnFtin/CDBFHoFqrZly3rC2z+e0=
github.com/wundergraph/cosmo/router-tests v0.0.0-20241213115435-a249dba8c52a h1:GVLe85f5g+G0IOorDBBNTfm5Ua9DO0vuVY7ReSTOEbQ=
github.com/wundergraph/cosmo/router-tests v0.0.0-20241213115435-a249dba8c52a/go.mod h1:I+SFviFnd3BHlPmYn+ckmzQyDB9+/c8RZJo4t6VQAds=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.138.0.20250106145350-20e4f82cea6b h1:DnIV7YVjrPcrJj2awt8M1F++ql6EfC0hB0Or0m4OXx4=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.138.0.20250106145350-20e4f82cea6b/go.mod h1:B7eV0Qh8Lop9QzIOQcsvKp3S0ejfC6mgyWoJnI917yQ=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.141 h1:lPwwEJRYYuJflv7fhgwaWKt6FKRdX5CJ1Yp6RWzzKDA=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.141/go.mod h1:B7eV0Qh8Lop9QzIOQcsvKp3S0ejfC6mgyWoJnI917yQ=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
Expand Down
86 changes: 68 additions & 18 deletions router-tests/cache_warmup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,21 @@ import (
"time"

"github.com/stretchr/testify/require"
"go.uber.org/zap"

"github.com/wundergraph/cosmo/router-tests/testenv"
"github.com/wundergraph/cosmo/router/core"
"github.com/wundergraph/cosmo/router/pkg/config"
"go.uber.org/zap"
)

func TestCacheWarmup(t *testing.T) {
t.Parallel()

t.Run("cache warmup tests for filesystem", func(t *testing.T) {
t.Parallel()

const employeeWarmedQueryCount = 1

t.Run("cache warmup disabled", func(t *testing.T) {
t.Parallel()
testenv.Run(t, &testenv.Config{}, func(t *testing.T, xEnv *testenv.Environment) {
Expand All @@ -28,6 +32,9 @@ func TestCacheWarmup(t *testing.T) {
})
t.Run("cache warmup enabled", func(t *testing.T) {
t.Parallel()

const employeeQueryCount = 2

testenv.Run(t, &testenv.Config{
RouterOptions: []core.Option{
core.WithCacheWarmupConfig(&config.CacheWarmupConfiguration{
Expand All @@ -41,12 +48,12 @@ func TestCacheWarmup(t *testing.T) {
},
AssertCacheMetrics: &testenv.CacheMetricsAssertions{
BaseGraphAssertions: testenv.CacheMetricsAssertion{
QueryNormalizationMisses: 3,
QueryNormalizationMisses: 3 + employeeWarmedQueryCount + employeeQueryCount,
QueryNormalizationHits: 4,
ValidationMisses: 3,
ValidationHits: 4,
PlanMisses: 3,
PlanHits: 4,
ValidationMisses: 3 + employeeWarmedQueryCount,
ValidationHits: 4 + employeeQueryCount,
PlanMisses: 3 + employeeWarmedQueryCount,
PlanHits: 4 + employeeQueryCount,
},
},
}, func(t *testing.T, xEnv *testenv.Environment) {
Expand All @@ -66,6 +73,19 @@ func TestCacheWarmup(t *testing.T) {
Query: `query { employees { id details { forename surname } } }`,
})
require.Equal(t, `{"data":{"employees":[{"id":1,"details":{"forename":"Jens","surname":"Neuse"}},{"id":2,"details":{"forename":"Dustin","surname":"Deus"}},{"id":3,"details":{"forename":"Stefan","surname":"Avram"}},{"id":4,"details":{"forename":"Björn","surname":"Schwenzer"}},{"id":5,"details":{"forename":"Sergiy","surname":"Petrunin"}},{"id":7,"details":{"forename":"Suvij","surname":"Surya"}},{"id":8,"details":{"forename":"Nithin","surname":"Kumar"}},{"id":10,"details":{"forename":"Eelco","surname":"Wiersma"}},{"id":11,"details":{"forename":"Alexandra","surname":"Neuse"}},{"id":12,"details":{"forename":"David","surname":"Stutt"}}]}}`, res.Body)

res = xEnv.MakeGraphQLRequestOK(testenv.GraphQLRequest{
Query: `query m($id: Int!){ employee(id: $id) { id details { forename surname } } }`,
Variables: []byte(`{"id": 1}`),
})
require.Equal(t, "HIT", res.Response.Header.Get("x-wg-execution-plan-cache"))
require.Equal(t, `{"data":{"employee":{"id":1,"details":{"forename":"Jens","surname":"Neuse"}}}}`, res.Body)

res = xEnv.MakeGraphQLRequestOK(testenv.GraphQLRequest{
Query: `query { employee(id: 2) { id details { forename surname } } }`,
})
require.Equal(t, "HIT", res.Response.Header.Get("x-wg-execution-plan-cache"))
require.Equal(t, `{"data":{"employee":{"id":2,"details":{"forename":"Dustin","surname":"Deus"}}}}`, res.Body)
})
})
t.Run("cache warmup invalid files", func(t *testing.T) {
Expand Down Expand Up @@ -337,13 +357,13 @@ func TestCacheWarmup(t *testing.T) {
},
AssertCacheMetrics: &testenv.CacheMetricsAssertions{
BaseGraphAssertions: testenv.CacheMetricsAssertion{
QueryNormalizationMisses: 3,
QueryNormalizationMisses: 3 + employeeWarmedQueryCount,
QueryNormalizationHits: 2,
ValidationMisses: 3,
ValidationMisses: 3 + employeeWarmedQueryCount,
ValidationHits: 2,
QueryHashMisses: 3,
QueryHashMisses: 3 + employeeWarmedQueryCount,
QueryHashHits: 2,
PlanMisses: 3,
PlanMisses: 3 + employeeWarmedQueryCount,
PlanHits: 2,
},
},
Expand All @@ -363,8 +383,8 @@ func TestCacheWarmup(t *testing.T) {
t.Run("cache warmup tests for cdn", func(t *testing.T) {
t.Parallel()

// keep in sync with testdata/cache_warmup/cdn/operation.json
cdnOperationCount := int64(4)
// keep in sync with testenv/testdata/cache_warmup/cdn/operation.json
cdnOperationCount := int64(5)
cdnPOCount := int64(1)
featureOperationCount := int64(1)
invalidOperationCount := int64(1)
Expand Down Expand Up @@ -397,6 +417,7 @@ func TestCacheWarmup(t *testing.T) {

t.Run("should correctly warm the cache with data from the operation.json file", func(t *testing.T) {
t.Parallel()
const employeeQueryCount = 2
testenv.Run(t, &testenv.Config{
RouterOptions: []core.Option{
core.WithCacheWarmupConfig(&config.CacheWarmupConfiguration{
Expand All @@ -405,14 +426,16 @@ func TestCacheWarmup(t *testing.T) {
},
AssertCacheMetrics: &testenv.CacheMetricsAssertions{
BaseGraphAssertions: testenv.CacheMetricsAssertion{
QueryNormalizationMisses: cdnOperationCount + featureOperationCount + invalidOperationCount,
// we have additional 2 misses for the employeeQueryCount - because their content differs from what we have in cdn
// this will be possible to solve only by having operation variants populated
QueryNormalizationMisses: cdnOperationCount + featureOperationCount + invalidOperationCount + employeeQueryCount,
QueryNormalizationHits: 3,
PersistedQueryNormalizationMisses: cdnPOCount,
PersistedQueryNormalizationHits: 0,
ValidationMisses: cdnOperationCount + cdnPOCount + featureOperationCount + invalidOperationCount,
ValidationHits: 3,
ValidationHits: 3 + employeeQueryCount,
PlanMisses: cdnOperationCount + cdnPOCount,
PlanHits: 3,
PlanHits: 3 + employeeQueryCount,
},
},
}, func(t *testing.T, xEnv *testenv.Environment) {
Expand All @@ -428,6 +451,24 @@ func TestCacheWarmup(t *testing.T) {
Query: `query { employees { id details { forename surname } } }`,
})
require.Equal(t, `{"data":{"employees":[{"id":1,"details":{"forename":"Jens","surname":"Neuse"}},{"id":2,"details":{"forename":"Dustin","surname":"Deus"}},{"id":3,"details":{"forename":"Stefan","surname":"Avram"}},{"id":4,"details":{"forename":"Björn","surname":"Schwenzer"}},{"id":5,"details":{"forename":"Sergiy","surname":"Petrunin"}},{"id":7,"details":{"forename":"Suvij","surname":"Surya"}},{"id":8,"details":{"forename":"Nithin","surname":"Kumar"}},{"id":10,"details":{"forename":"Eelco","surname":"Wiersma"}},{"id":11,"details":{"forename":"Alexandra","surname":"Neuse"}},{"id":12,"details":{"forename":"David","surname":"Stutt"}}]}}`, res.Body)

// For the next 2 queries below we will:
// - miss normalization cache
// - hit validation cache
// - hit plan cache

res = xEnv.MakeGraphQLRequestOK(testenv.GraphQLRequest{
Comment thread
devsergiy marked this conversation as resolved.
Query: `query m($id: Int!){ employee(id: $id) { id details { forename surname } } }`,
Variables: []byte(`{"id": 1}`),
})
require.Equal(t, "HIT", res.Response.Header.Get("x-wg-execution-plan-cache"))
require.Equal(t, `{"data":{"employee":{"id":1,"details":{"forename":"Jens","surname":"Neuse"}}}}`, res.Body)

res = xEnv.MakeGraphQLRequestOK(testenv.GraphQLRequest{
Query: `query { employee(id: 2) { id details { forename surname } } }`,
})
require.Equal(t, "HIT", res.Response.Header.Get("x-wg-execution-plan-cache"))
require.Equal(t, `{"data":{"employee":{"id":2,"details":{"forename":"Dustin","surname":"Deus"}}}}`, res.Body)
})
})

Expand All @@ -446,12 +487,12 @@ func TestCacheWarmup(t *testing.T) {
BaseGraphAssertions: testenv.CacheMetricsAssertion{
QueryNormalizationMisses: cdnOperationCount + featureOperationCount + invalidOperationCount,
QueryNormalizationHits: 0,
PersistedQueryNormalizationMisses: cdnPOCount,
PersistedQueryNormalizationMisses: cdnPOCount + 2,
PersistedQueryNormalizationHits: 1,
ValidationMisses: cdnOperationCount + cdnPOCount + featureOperationCount + invalidOperationCount,
ValidationHits: 1,
ValidationHits: 2,
PlanMisses: cdnOperationCount + cdnPOCount,
PlanHits: 1,
PlanHits: 2,
},
},
}, func(t *testing.T, xEnv *testenv.Environment) {
Expand All @@ -465,6 +506,15 @@ func TestCacheWarmup(t *testing.T) {

require.NoError(t, err)
require.Equal(t, expected, res.Body)

res, err = xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{
OperationName: []byte(`"A"`),
Extensions: []byte(`{"persistedQuery": {"version": 1, "sha256Hash": "e24399f210ef3f16e6e5427a70bb9609ecea7297e99c3e9241d5912d04eabe60"}}`),
Header: header,
})
require.NoError(t, err)
require.Equal(t, "HIT", res.Response.Header.Get("x-wg-execution-plan-cache"))
require.Equal(t, `{"data":{"employee":{"id":1,"details":{"forename":"Jens","surname":"Neuse"}}}}`, res.Body)
})
})

Expand Down
8 changes: 4 additions & 4 deletions router-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ require (
github.com/tidwall/gjson v1.18.0
github.com/twmb/franz-go v1.16.1
github.com/twmb/franz-go/pkg/kadm v1.11.0
github.com/wundergraph/cosmo/demo v0.0.0-20250107115408-cdd3d47d6424
github.com/wundergraph/cosmo/router v0.0.0-20250107115408-cdd3d47d6424
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.139
github.com/wundergraph/cosmo/demo v0.0.0-20250119174948-4b991294658e
github.com/wundergraph/cosmo/router v0.0.0-20250119174948-4b991294658e
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.142
go.opentelemetry.io/otel v1.28.0
go.opentelemetry.io/otel/sdk v1.28.0
go.opentelemetry.io/otel/sdk/metric v1.28.0
go.opentelemetry.io/otel/trace v1.28.0
go.uber.org/atomic v1.11.0
go.uber.org/zap v1.27.0
golang.org/x/net v0.33.0
google.golang.org/protobuf v1.34.2
gopkg.in/yaml.v3 v3.0.1
)
Expand Down Expand Up @@ -159,7 +160,6 @@ require (
golang.org/x/crypto v0.31.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.33.0 // indirect
golang.org/x/sync v0.10.0 // indirect
golang.org/x/sys v0.29.0 // indirect
golang.org/x/text v0.21.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions router-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ github.com/vektah/gqlparser/v2 v2.5.16 h1:1gcmLTvs3JLKXckwCwlUagVn/IlV2bwqle0vJ0
github.com/vektah/gqlparser/v2 v2.5.16/go.mod h1:1lz1OeCqgQbQepsGxPVywrjdBHW2T08PUS3pJqepRww=
github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083 h1:8/D7f8gKxTBjW+SZK4mhxTTBVpxcqeBgWF1Rfmltbfk=
github.com/wundergraph/astjson v0.0.0-20250106123708-be463c97e083/go.mod h1:eOTL6acwctsN4F3b7YE+eE2t8zcJ/doLm9sZzsxxxrE=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.139 h1:ZxdsKeD3igrOpJtpyUk+Y9jC+///mj2MN/t9mDeX/7E=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.139/go.mod h1:B7eV0Qh8Lop9QzIOQcsvKp3S0ejfC6mgyWoJnI917yQ=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.142 h1:CNuk0zoqmoJVP9Wq03GWLvi64Vpq1qwBIdRgV1669U8=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.142/go.mod h1:B7eV0Qh8Lop9QzIOQcsvKp3S0ejfC6mgyWoJnI917yQ=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 h1:+qGGcbkzsfDQNPPe9UDgpxAWQrhbbBXOYJFQDq/dtJw=
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913/go.mod h1:4aEEwZQutDLsQv2Deui4iYQ6DWTxR14g6m8Wv88+Xqk=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
14 changes: 10 additions & 4 deletions router-tests/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ func TestExecutionPlanCache(t *testing.T) {
t.Parallel()

testenv.Run(t, &testenv.Config{}, func(t *testing.T, xEnv *testenv.Environment) {

// MISS - First query
res, err := xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{
Query: `query Find($criteria: SearchInput!) {findEmployees(criteria: $criteria){id details {forename surname}}}`,
Variables: json.RawMessage(`{"criteria":{"nationality":"GERMAN"}}`),
Expand All @@ -110,24 +112,28 @@ func TestExecutionPlanCache(t *testing.T) {
require.Equal(t, "MISS", res.Response.Header.Get("X-WG-Execution-Plan-Cache"))
require.Equal(t, `{"data":{"findEmployees":[{"id":1,"details":{"forename":"Jens","surname":"Neuse"}},{"id":2,"details":{"forename":"Dustin","surname":"Deus"}},{"id":4,"details":{"forename":"Björn","surname":"Schwenzer"}},{"id":11,"details":{"forename":"Alexandra","surname":"Neuse"}}]}}`, res.Body)

// HIT - Same query as above with different variables
res, err = xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{
Query: `query Find($criteria: SearchInput!) {findEmployees(criteria: $criteria){id details {forename surname}}}`,
Variables: json.RawMessage(`{"criteria":{"nationality":"GERMAN"}}`),
Variables: json.RawMessage(`{"criteria":{"nationality":"AMERICAN"}}`),
})
require.NoError(t, err)
require.Equal(t, http.StatusOK, res.Response.StatusCode)
require.Equal(t, "HIT", res.Response.Header.Get("X-WG-Execution-Plan-Cache"))
require.Equal(t, `{"data":{"findEmployees":[{"id":1,"details":{"forename":"Jens","surname":"Neuse"}},{"id":2,"details":{"forename":"Dustin","surname":"Deus"}},{"id":4,"details":{"forename":"Björn","surname":"Schwenzer"}},{"id":11,"details":{"forename":"Alexandra","surname":"Neuse"}}]}}`, res.Body)
require.Equal(t, `{"data":{"findEmployees":[{"id":3,"details":{"forename":"Stefan","surname":"Avram"}}]}}`, res.Body)

// HIT - Same query as above with inline variables
res, err = xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{
Query: `query Find($criteria: SearchInput! = { nationality: ENGLISH }) {findEmployees(criteria: $criteria){id details {forename surname}}}`,
})
require.NoError(t, err)
require.Equal(t, http.StatusOK, res.Response.StatusCode)
require.Equal(t, "MISS", res.Response.Header.Get("X-WG-Execution-Plan-Cache"))
require.Equal(t, "HIT", res.Response.Header.Get("X-WG-Execution-Plan-Cache"))
require.Equal(t, `{"data":{"findEmployees":[{"id":12,"details":{"forename":"David","surname":"Stutt"}}]}}`, res.Body)

// HIT - Same query as above but with different whitespace and operation name
res, err = xEnv.MakeGraphQLRequest(testenv.GraphQLRequest{
Query: `query Find($criteria: SearchInput! = { nationality: ENGLISH }) {findEmployees(criteria: $criteria){id details {forename surname}}}`,
Query: `query Foo ($criteria: SearchInput! = { nationality: ENGLISH }) {findEmployees(criteria: $criteria){id details {forename surname}}}`,
})
require.NoError(t, err)
require.Equal(t, http.StatusOK, res.Response.StatusCode)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
query { employee(id: 2) { id details { forename surname } } }
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,12 @@
"request": {
"query": "query { employees { id } nonExistentField }"
}
},
{
"hint": "This is normalized representation of an employee query",
"request": {
"query": "query($a: Int!){employee(id: $a){id details {forename surname}}}"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":1,"body":"query A {\n employee(id: 1) {\n id\n details {forename surname}\n }\n}\n\n"}
19 changes: 13 additions & 6 deletions router/core/cache_warmup.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@ package core
import (
"context"
"errors"
"google.golang.org/protobuf/encoding/protojson"
"time"

"go.uber.org/ratelimit"
"go.uber.org/zap"
"google.golang.org/protobuf/encoding/protojson"

"github.com/wundergraph/astjson"
nodev1 "github.com/wundergraph/cosmo/router/gen/proto/wg/cosmo/node/v1"
"github.com/wundergraph/cosmo/router/pkg/config"
"github.com/wundergraph/graphql-go-tools/v2/pkg/ast"
"github.com/wundergraph/graphql-go-tools/v2/pkg/engine/resolve"
"go.uber.org/ratelimit"
"go.uber.org/zap"

nodev1 "github.com/wundergraph/cosmo/router/gen/proto/wg/cosmo/node/v1"
"github.com/wundergraph/cosmo/router/pkg/config"
)

type CacheWarmupItem struct {
Expand Down Expand Up @@ -276,7 +278,12 @@ func (c *CacheWarmupPlanningProcessor) ProcessOperation(ctx context.Context, ope
return err
}

_, err = k.Validate(true)
err = k.RemapVariables()
if err != nil {
return err
}

_, err = k.Validate(true, k.parsedOperation.RemapVariables)
if err != nil {
return err
}
Expand Down
Loading