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
3 changes: 2 additions & 1 deletion demo/pkg/subgraphs/courses/generated/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@
"key": "id",
"rpc": "LookupEmployeeById",
"request": "LookupEmployeeByIdRequest",
"response": "LookupEmployeeByIdResponse"
"response": "LookupEmployeeByIdResponse",
"requiredFieldMappings": []
}
],
"typeFieldMappings": [
Expand Down
15 changes: 10 additions & 5 deletions demo/pkg/subgraphs/projects/generated/mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,39 +150,44 @@
"key": "id",
"rpc": "LookupProjectById",
"request": "LookupProjectByIdRequest",
"response": "LookupProjectByIdResponse"
"response": "LookupProjectByIdResponse",
"requiredFieldMappings": []
},
{
"typeName": "Milestone",
"kind": "entity",
"key": "id",
"rpc": "LookupMilestoneById",
"request": "LookupMilestoneByIdRequest",
"response": "LookupMilestoneByIdResponse"
"response": "LookupMilestoneByIdResponse",
"requiredFieldMappings": []
},
{
"typeName": "Task",
"kind": "entity",
"key": "id",
"rpc": "LookupTaskById",
"request": "LookupTaskByIdRequest",
"response": "LookupTaskByIdResponse"
"response": "LookupTaskByIdResponse",
"requiredFieldMappings": []
},
{
"typeName": "Employee",
"kind": "entity",
"key": "id",
"rpc": "LookupEmployeeById",
"request": "LookupEmployeeByIdRequest",
"response": "LookupEmployeeByIdResponse"
"response": "LookupEmployeeByIdResponse",
"requiredFieldMappings": []
},
{
"typeName": "Product",
"kind": "entity",
"key": "upc",
"rpc": "LookupProductByUpc",
"request": "LookupProductByUpcRequest",
"response": "LookupProductByUpcResponse"
"response": "LookupProductByUpcResponse",
"requiredFieldMappings": []
}
],
"typeFieldMappings": [
Expand Down
1,087 changes: 543 additions & 544 deletions demo/pkg/subgraphs/projects/generated/service.pb.go

Large diffs are not rendered by default.

3 changes: 0 additions & 3 deletions demo/pkg/subgraphs/projects/generated/service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,6 @@ message ResolveEmployeeAverageTaskCompletionDaysResponse {
}

message Project {
reserved 20 to 25;
string id = 1;
string name = 2;
google.protobuf.StringValue description = 3;
Expand All @@ -787,7 +786,6 @@ message Project {
}

message Milestone {
reserved 12 to 13;
string id = 1;
string project_id = 2;
string name = 3;
Expand Down Expand Up @@ -824,7 +822,6 @@ message Task {
}

message Employee {
reserved 8 to 9;
int32 id = 1;
ListOfProject projects = 2;
repeated Task assigned_tasks = 3;
Expand Down
26 changes: 9 additions & 17 deletions demo/pkg/subgraphs/projects/generated/service.proto.lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,7 @@
"resourceGroups": 16,
"tasksByPhase": 17,
"milestoneGroups": 18,
"priorityMatrix": 19,
"subProjects": 25,
"filteredTasks": 20,
"completionRate": 21,
"estimatedDaysRemaining": 22,
"criticalDeadline": 23,
"topPriorityItem": 24
"priorityMatrix": 19
}
},
"Milestone": {
Expand All @@ -372,9 +366,7 @@
"completionPercentage": 8,
"dependencies": 9,
"subtasks": 10,
"reviewers": 11,
"isAtRisk": 12,
"daysUntilDue": 13
"reviewers": 11
}
},
"Task": {
Expand All @@ -395,10 +387,12 @@
"subtasks": 14,
"dependencies": 15,
"attachmentUrls": 16,
"reviewerIds": 17,
"isBlocked": 18,
"totalEffort": 19
}
"reviewerIds": 17
},
"reservedNumbers": [
18,
19
]
},
"Employee": {
"fields": {
Expand All @@ -408,9 +402,7 @@
"completedTasks": 4,
"skills": 5,
"certifications": 6,
"projectHistory": 7,
"currentWorkload": 8,
"averageTaskCompletionDays": 9
"projectHistory": 7
}
},
"Product": {
Expand Down
2 changes: 1 addition & 1 deletion router-tests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/wundergraph/cosmo/demo/pkg/subgraphs/projects v0.0.0-20250715110703-10f2e5f9c79e
github.com/wundergraph/cosmo/router v0.0.0-20260213130455-6e3277e7b850
github.com/wundergraph/cosmo/router-plugin v0.0.0-20250808194725-de123ba1c65e
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.257
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.260
go.opentelemetry.io/otel v1.36.0
go.opentelemetry.io/otel/sdk v1.36.0
go.opentelemetry.io/otel/sdk/metric v1.36.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 @@ -356,8 +356,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.1.0 h1:9+wSRkJAkA2vbYHp6s8tEGhPViRGQNGXqPHT0QzhdIc=
github.com/wundergraph/go-arena v1.1.0/go.mod h1:ROOysEHWJjLQ8FSfNxZCziagb7Qw2nXY3/vgKRh7eWw=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.257 h1:hGsaKXRkH3o8DkyizY48/wC1Q+NB1nfD9EKVA7Gc81Y=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.257/go.mod h1:gfmmrPd2khZONmwYE8RIfnGjwIG+RqL52jYiBzcUST8=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.260 h1:mVls0cWupP3ob16NwYiOP7jcNQnp89Abz4d3kz3ss7c=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.260/go.mod h1:gfmmrPd2khZONmwYE8RIfnGjwIG+RqL52jYiBzcUST8=
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
17 changes: 16 additions & 1 deletion router-tests/grpc_subgraph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ func TestGRPCSubgraph(t *testing.T) {
query: `
query {
nodesById(id: 1) {
__typename
__typename
... on Project {
id
}
Expand Down Expand Up @@ -264,6 +264,21 @@ func TestGRPCSubgraph(t *testing.T) {
query: `{ project(id: 2) { id name urgent: topPriorityItem(category: "task") { __typename } nextDeadline: criticalDeadline(withinDays: 10000) { __typename } subsub: subProjects { id name status otherSubs: subProjects { id name } } } }`,
expected: `{"data":{"project":{"id":"2","name":"Microservices Revolution","urgent":{"__typename":"Task"},"nextDeadline":{"__typename":"Milestone"},"subsub":[{"id":"4","name":"DevOps Transformation","status":"PLANNING","otherSubs":[{"id":"1","name":"Cloud Migration Overhaul"}]},{"id":"5","name":"Security Overhaul","status":"ON_HOLD","otherSubs":[{"id":"2","name":"Microservices Revolution"}]}]}}}`,
},
{
name: "query non-existent project returns null without invoking field resolvers",
query: `{ project(id: 999) { id name topPriorityItem(category: "task") { __typename } criticalDeadline(withinDays: 10000) { __typename } } }`,
expected: `{"data":{"project":null}}`,
},
{
name: "query non-existent project returns null without invoking recursive field resolvers",
query: `{ project(id: 999) { id name subProjects { id name status subProjects { id name } } } }`,
expected: `{"data":{"project":null}}`,
},
{
name: "query non-existent project returns null without invoking nested field resolvers with aliases",
query: `{ project(id: 999) { id name urgent: topPriorityItem(category: "task") { __typename } nextDeadline: criticalDeadline(withinDays: 10000) { __typename } subsub: subProjects { id name status otherSubs: subProjects { id name } } } }`,
expected: `{"data":{"project":null}}`,
},
}
testenv.Run(t, &testenv.Config{
RouterConfigJSONTemplate: testenv.ConfigWithGRPCJSONTemplate,
Expand Down
25 changes: 20 additions & 5 deletions router-tests/router_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,26 @@ func TestRouterPluginRequests(t *testing.T) {
query: `query { project(id:2) { id name urgent: topPriorityItem(category: "task") { __typename } nextDeadline: criticalDeadline(withinDays: 10000) { __typename } subsub: subProjects { id name status } } }`,
expected: `{"data":{"project":{"id":"2","name":"Microservices Revolution","urgent":{"__typename":"Task"},"nextDeadline":{"__typename":"Milestone"},"subsub":[{"id":"4","name":"DevOps Transformation","status":"PLANNING"},{"id":"5","name":"Security Overhaul","status":"ON_HOLD"}]}}}`,
},
{
name: "query project with normal and recursive field resolver and aliases and multiple levels of recursion and aliases",
query: `{ project(id: 2) { id name urgent: topPriorityItem(category: "task") { __typename } nextDeadline: criticalDeadline(withinDays: 10000) { __typename } subsub: subProjects { id name status otherSubs: subProjects { id name } } } }`,
expected: `{"data":{"project":{"id":"2","name":"Microservices Revolution","urgent":{"__typename":"Task"},"nextDeadline":{"__typename":"Milestone"},"subsub":[{"id":"4","name":"DevOps Transformation","status":"PLANNING","otherSubs":[{"id":"1","name":"Cloud Migration Overhaul"}]},{"id":"5","name":"Security Overhaul","status":"ON_HOLD","otherSubs":[{"id":"2","name":"Microservices Revolution"}]}]}}}`,
},
{
name: "query project with normal and recursive field resolver and aliases and multiple levels of recursion and aliases",
query: `{ project(id: 2) { id name urgent: topPriorityItem(category: "task") { __typename } nextDeadline: criticalDeadline(withinDays: 10000) { __typename } subsub: subProjects { id name status otherSubs: subProjects { id name } } } }`,
expected: `{"data":{"project":{"id":"2","name":"Microservices Revolution","urgent":{"__typename":"Task"},"nextDeadline":{"__typename":"Milestone"},"subsub":[{"id":"4","name":"DevOps Transformation","status":"PLANNING","otherSubs":[{"id":"1","name":"Cloud Migration Overhaul"}]},{"id":"5","name":"Security Overhaul","status":"ON_HOLD","otherSubs":[{"id":"2","name":"Microservices Revolution"}]}]}}}`,
},
{
name: "query non-existent project returns null without invoking field resolvers",
query: `{ project(id: 999) { id name topPriorityItem(category: "task") { __typename } criticalDeadline(withinDays: 10000) { __typename } } }`,
expected: `{"data":{"project":null}}`,
},
{
name: "query non-existent project returns null without invoking recursive field resolvers",
query: `{ project(id: 999) { id name subProjects { id name status subProjects { id name } } } }`,
expected: `{"data":{"project":null}}`,
},
{
name: "query non-existent project returns null without invoking nested field resolvers with aliases",
query: `{ project(id: 999) { id name urgent: topPriorityItem(category: "task") { __typename } nextDeadline: criticalDeadline(withinDays: 10000) { __typename } subsub: subProjects { id name status otherSubs: subProjects { id name } } } }`,
expected: `{"data":{"project":null}}`,
},
}
testenv.Run(t, &testenv.Config{
RouterConfigJSONTemplate: testenv.ConfigWithPluginsJSONTemplate,
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.0.0-rc.257
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.260
// Do not upgrade, it renames attributes we rely on
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0
go.opentelemetry.io/contrib/propagators/b3 v1.23.0
Expand Down
4 changes: 2 additions & 2 deletions router/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,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.1.0 h1:9+wSRkJAkA2vbYHp6s8tEGhPViRGQNGXqPHT0QzhdIc=
github.com/wundergraph/go-arena v1.1.0/go.mod h1:ROOysEHWJjLQ8FSfNxZCziagb7Qw2nXY3/vgKRh7eWw=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.257 h1:hGsaKXRkH3o8DkyizY48/wC1Q+NB1nfD9EKVA7Gc81Y=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.257/go.mod h1:gfmmrPd2khZONmwYE8RIfnGjwIG+RqL52jYiBzcUST8=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.260 h1:mVls0cWupP3ob16NwYiOP7jcNQnp89Abz4d3kz3ss7c=
github.com/wundergraph/graphql-go-tools/v2 v2.0.0-rc.260/go.mod h1:gfmmrPd2khZONmwYE8RIfnGjwIG+RqL52jYiBzcUST8=
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