Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
2 changes: 1 addition & 1 deletion router-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/wundergraph/cosmo/router v0.0.0-20260710155145-803a4bc06d92
github.com/wundergraph/cosmo/router-plugin v0.0.0-20250808194725-de123ba1c65e
github.com/wundergraph/cosmo/speedtrap v0.0.0-00010101000000-000000000000
github.com/wundergraph/graphql-go-tools/v2 v2.13.2
github.com/wundergraph/graphql-go-tools/v2 v2.14.1
go.opentelemetry.io/otel v1.44.0
go.opentelemetry.io/otel/sdk v1.44.0
go.opentelemetry.io/otel/sdk/metric v1.44.0
Expand Down
4 changes: 2 additions & 2 deletions router-tests/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,8 @@ github.com/wundergraph/astjson v1.1.0 h1:xORDosrZ87zQFJwNGe/HIHXqzpdHOFmqWgykCLV
github.com/wundergraph/astjson v1.1.0/go.mod h1:h12D/dxxnedtLzsKyBLK7/Oe4TAoGpRVC9nDpDrZSWw=
github.com/wundergraph/go-arena v1.3.0 h1:n0ng5a1vbd8YGq1u3rMr0vPU5f6AZ1BXIiUhL1UIok8=
github.com/wundergraph/go-arena v1.3.0/go.mod h1:ROOysEHWJjLQ8FSfNxZCziagb7Qw2nXY3/vgKRh7eWw=
github.com/wundergraph/graphql-go-tools/v2 v2.13.2 h1:YbK0HRgqoYNrlaFJDxST2+G9zex6okKLtjgDXNeVd48=
github.com/wundergraph/graphql-go-tools/v2 v2.13.2/go.mod h1:zREIKLmpjfNcGSubndaW/913r0Y8XbbYOXQeZFkwHdo=
github.com/wundergraph/graphql-go-tools/v2 v2.14.1 h1:TecnvTyhskoeiqo6W+1xh7HqAPL/RG5vfbFhezu7RLs=
github.com/wundergraph/graphql-go-tools/v2 v2.14.1/go.mod h1:zREIKLmpjfNcGSubndaW/913r0Y8XbbYOXQeZFkwHdo=
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342 h1:FnBeRrxr7OU4VvAzt5X7s6266i6cSVkkFPS0TuXWbIg=
github.com/xrash/smetrics v0.0.0-20250705151800-55b8f293f342/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM=
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
Expand Down
20 changes: 20 additions & 0 deletions router-tests/protocol/grpc_subgraph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,11 @@ func TestGRPCSubgraph(t *testing.T) {
query: `{ employee(id: 1) { id taggedProjectSummary } }`,
expected: `{"data":{"employee":{"id":1,"taggedProjectSummary":"expertise: Backend Architecture, project tags: [cloud, migration, priority, devops, ci-cd, infrastructure]"}}}`,
},
{
name: "query employee @requires field resolved with expertise and aliased",
query: `{ employee(id: 1) { id preAlias: taggedProjectSummary taggedProjectSummary aliasedTaggedProjectSummary: taggedProjectSummary } }`,
expected: `{"data":{"employee":{"id":1,"preAlias":"expertise: Backend Architecture, project tags: [cloud, migration, priority, devops, ci-cd, infrastructure]","taggedProjectSummary":"expertise: Backend Architecture, project tags: [cloud, migration, priority, devops, ci-cd, infrastructure]","aliasedTaggedProjectSummary":"expertise: Backend Architecture, project tags: [cloud, migration, priority, devops, ci-cd, infrastructure]"}}}`,
},
{
name: "query employee @requires field resolved with expertise (employee 2)",
query: `{ employee(id: 2) { id taggedProjectSummary } }`,
Expand Down Expand Up @@ -352,6 +357,11 @@ func TestGRPCSubgraph(t *testing.T) {
query: `{ employee(id: 2) { id reviewReport } }`,
expected: `{"data":{"employee":{"id":2,"reviewReport":"Rejected: Needs more documentation (code: DOC_001)"}}}`,
},
{
name: "query employee @requires flat union aliased (approval)",
query: `{ employee(id: 1) { id aliasedReviewReport: reviewReport } }`,
expected: `{"data":{"employee":{"id":1,"aliasedReviewReport":"Approved: Excellent work on the API at 2024-01-15"}}}`,
},
// Pattern 3: Concrete wrapping abstract
{
name: "query employee @requires concrete wrapping abstract (technical)",
Expand Down Expand Up @@ -396,12 +406,22 @@ func TestGRPCSubgraph(t *testing.T) {
query: `{ employee(id: 2) { id deepWorkItemInfo } }`,
expected: `{"data":{"employee":{"id":2,"deepWorkItemInfo":"ManagementHandler: Bob Lead"}}}`,
},
{
name: "query employee @requires aliased nested abstract through concrete (management deep)",
query: `{ employee(id: 2) { id aliasedDeepWorkItemInfo: deepWorkItemInfo } }`,
expected: `{"data":{"employee":{"id":2,"aliasedDeepWorkItemInfo":"ManagementHandler: Bob Lead"}}}`,
},
// Non-existent employee with composite @requires fields
{
name: "query non-existent employee with @requires composite fields returns null",
query: `{ employee(id: 999) { id workItemInfo reviewReport } }`,
expected: `{"data":{"employee":null}}`,
},
{
name: "query non-existent employee with @requires and aliased fields returns null",
query: `{ employee(id: 999) { id workItemInfo reviewReport aliasedReviewReport: reviewReport } }`,
expected: `{"data":{"employee":null}}`,
},
Comment thread
coderabbitai[bot] marked this conversation as resolved.
}
testenv.Run(t, &testenv.Config{
RouterConfigJSONTemplate: testenv.ConfigWithGRPCJSONTemplate,
Expand Down
2 changes: 1 addition & 1 deletion router/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ require (
github.com/tidwall/gjson v1.18.0
github.com/tidwall/sjson v1.2.5
github.com/twmb/franz-go v1.16.1
github.com/wundergraph/graphql-go-tools/v2 v2.13.2
github.com/wundergraph/graphql-go-tools/v2 v2.14.1
// Do not upgrade, it renames attributes we rely on
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.68.0
go.opentelemetry.io/contrib/propagators/b3 v1.44.0
Expand Down
4 changes: 2 additions & 2 deletions router/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ github.com/wundergraph/astjson v1.1.0 h1:xORDosrZ87zQFJwNGe/HIHXqzpdHOFmqWgykCLV
github.com/wundergraph/astjson v1.1.0/go.mod h1:h12D/dxxnedtLzsKyBLK7/Oe4TAoGpRVC9nDpDrZSWw=
github.com/wundergraph/go-arena v1.3.0 h1:n0ng5a1vbd8YGq1u3rMr0vPU5f6AZ1BXIiUhL1UIok8=
github.com/wundergraph/go-arena v1.3.0/go.mod h1:ROOysEHWJjLQ8FSfNxZCziagb7Qw2nXY3/vgKRh7eWw=
github.com/wundergraph/graphql-go-tools/v2 v2.13.2 h1:YbK0HRgqoYNrlaFJDxST2+G9zex6okKLtjgDXNeVd48=
github.com/wundergraph/graphql-go-tools/v2 v2.13.2/go.mod h1:zREIKLmpjfNcGSubndaW/913r0Y8XbbYOXQeZFkwHdo=
github.com/wundergraph/graphql-go-tools/v2 v2.14.1 h1:TecnvTyhskoeiqo6W+1xh7HqAPL/RG5vfbFhezu7RLs=
github.com/wundergraph/graphql-go-tools/v2 v2.14.1/go.mod h1:zREIKLmpjfNcGSubndaW/913r0Y8XbbYOXQeZFkwHdo=
github.com/yosida95/uritemplate/v3 v3.0.2 h1:Ed3Oyj9yrmi9087+NczuL5BwkIc4wvTb5zIM+UJPGz4=
github.com/yosida95/uritemplate/v3 v3.0.2/go.mod h1:ILOh0sOhIJR3+L/8afwt/kE++YT040gmv5BQTMR2HP4=
github.com/yuin/gopher-lua v1.1.1 h1:kYKnWBjvbNP4XLT3+bPEwAXJx262OhaHDWDVOPjL46M=
Expand Down
Loading