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
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
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 @@ -269,6 +269,21 @@ func TestGRPCSubgraph(t *testing.T) {
query: `query { projectResources(projectId: "1") { ... on Milestone { id name dependencies { id name } } ... on Task { id name subtasks { id name } } } }`,
expected: `{"data":{"projectResources":[{},{},{},{},{"id":"1","name":"Infrastructure Assessment","dependencies":[]},{"id":"2","name":"Cloud Environment Setup","dependencies":[{"id":"1","name":"Infrastructure Assessment"},{"id":"","name":""}]},{"id":"3","name":"Application Migration","dependencies":[{"id":"2","name":"Cloud Environment Setup"},{"id":"","name":""}]},{"id":"1","name":"Current Infrastructure Audit","subtasks":[{"id":"1a","name":"Server Inventory"},{"id":"1b","name":"Database Inventory"},{"id":"","name":""}]},{"id":"2","name":"Cloud Provider Selection","subtasks":null},{"id":"3","name":"Network Setup","subtasks":[{"id":"3a","name":"VPC Configuration"},{"id":"3b","name":"Security Groups"},{"id":"","name":""}]},{"id":"14","name":"Database Migration","subtasks":[]}]}}`,
},
{
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
15 changes: 15 additions & 0 deletions router-tests/router_plugin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,21 @@ func TestRouterPluginRequests(t *testing.T) {
query: `query { projectResources(projectId: "1") { ... on Milestone { id name dependencies { id name } } ... on Task { id name subtasks { id name } } } }`,
expected: `{"data":{"projectResources":[{},{},{},{},{"id":"1","name":"Infrastructure Assessment","dependencies":[]},{"id":"2","name":"Cloud Environment Setup","dependencies":[{"id":"1","name":"Infrastructure Assessment"},{"id":"","name":""}]},{"id":"3","name":"Application Migration","dependencies":[{"id":"2","name":"Cloud Environment Setup"},{"id":"","name":""}]},{"id":"1","name":"Current Infrastructure Audit","subtasks":[{"id":"1a","name":"Server Inventory"},{"id":"1b","name":"Database Inventory"},{"id":"","name":""}]},{"id":"2","name":"Cloud Provider Selection","subtasks":null},{"id":"3","name":"Network Setup","subtasks":[{"id":"3a","name":"VPC Configuration"},{"id":"3b","name":"Security Groups"},{"id":"","name":""}]},{"id":"14","name":"Database Migration","subtasks":[]}]}}`,
},
{
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
Loading