diff --git a/src/HotChocolate/Fusion/src/Core/Execution/Nodes/ResolveByKeyBatch.cs b/src/HotChocolate/Fusion/src/Core/Execution/Nodes/ResolveByKeyBatch.cs index edc4c967b37..3b7976a4817 100644 --- a/src/HotChocolate/Fusion/src/Core/Execution/Nodes/ResolveByKeyBatch.cs +++ b/src/HotChocolate/Fusion/src/Core/Execution/Nodes/ResolveByKeyBatch.cs @@ -75,7 +75,7 @@ protected override async Task OnExecuteAsync( var batchExecutionState = CreateBatchBatchState(executionState, Requires); // Create the batch subgraph request. - var variableValues = BuildVariables(batchExecutionState, _argumentTypes); + var variableValues = BuildVariables(batchExecutionState, Requires, _argumentTypes); var request = CreateRequest(context.OperationContext.Variables, variableValues); // Once we have the batch request, we will enqueue it for execution with @@ -194,6 +194,7 @@ private void ProcessResult( private static Dictionary BuildVariables( BatchExecutionState[] batchExecutionState, + string[] requires, Dictionary argumentTypes) { var first = batchExecutionState[0]; @@ -220,7 +221,7 @@ private static Dictionary BuildVariables( batchState = ref Unsafe.Add(ref batchState, 1)!; } - foreach (var key in first.VariableValues.Keys) + foreach (var key in requires) { var expectedType = argumentTypes[key]; @@ -240,7 +241,7 @@ private static Dictionary BuildVariables( } else { - if (batchExecutionState[0].VariableValues.TryGetValue(key, out var variableValue)) + if (first.VariableValues.TryGetValue(key, out var variableValue)) { variableValues.Add(key, variableValue); } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/AutomaticMockingTests.cs b/src/HotChocolate/Fusion/test/Core.Tests/AutomaticMockingTests.cs index 0b2f15d3da1..b559e5b0722 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/AutomaticMockingTests.cs +++ b/src/HotChocolate/Fusion/test/Core.Tests/AutomaticMockingTests.cs @@ -42,7 +42,7 @@ type Object { { "data": { "obj": { - "id": "1", + "id": "Object:1", "str": "string" } } @@ -177,15 +177,15 @@ type Object { "data": { "objs": [ { - "id": "1", + "id": "Object:1", "str": "string" }, { - "id": "2", + "id": "Object:2", "str": "string" }, { - "id": "3", + "id": "Object:3", "str": "string" } ] @@ -234,29 +234,29 @@ type Object { "data": { "objsA": [ { - "id": "1", + "id": "Object:1", "str": "string" }, { - "id": "2", + "id": "Object:2", "str": "string" }, { - "id": "3", + "id": "Object:3", "str": "string" } ], "objsB": [ { - "id": "4", + "id": "Object:4", "str": "string" }, { - "id": "5", + "id": "Object:5", "str": "string" }, { - "id": "6", + "id": "Object:6", "str": "string" } ] @@ -298,11 +298,11 @@ type Object { "data": { "objs": [ { - "id": "1" + "id": "Object:1" }, null, { - "id": "3" + "id": "Object:3" } ] } @@ -358,11 +358,11 @@ type Object { "data": { "objs": [ { - "id": "1" + "id": "Object:1" }, null, { - "id": "3" + "id": "Object:3" } ] } @@ -529,7 +529,7 @@ ... on Object { "data": { "intrface": { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string", "num": 123 } @@ -696,19 +696,19 @@ ... on Object { "interfaces": [ { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string", "num": 123 }, { "__typename": "Object", - "id": "2", + "id": "Object:2", "str": "string", "num": 123 }, { "__typename": "Object", - "id": "3", + "id": "Object:3", "str": "string", "num": 123 } @@ -876,14 +876,14 @@ ... on Object { "interfaces": [ { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string", "num": 123 }, null, { "__typename": "Object", - "id": "3", + "id": "Object:3", "str": "string", "num": 123 } @@ -954,14 +954,14 @@ ... on Object { "interfaces": [ { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string", "num": 123 }, null, { "__typename": "Object", - "id": "3", + "id": "Object:3", "str": "string", "num": 123 } @@ -1017,19 +1017,19 @@ ... on Object { "interfaces": [ { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string", "num": 123 }, { "__typename": "Object", - "id": "2", + "id": "Object:2", "str": "string", "num": null }, { "__typename": "Object", - "id": "3", + "id": "Object:3", "str": "string", "num": 123 } @@ -1101,19 +1101,19 @@ ... on Object { "interfaces": [ { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string", "num": 123 }, { "__typename": "Object", - "id": "2", + "id": "Object:2", "str": "string", "num": null }, { "__typename": "Object", - "id": "3", + "id": "Object:3", "str": "string", "num": 123 } @@ -1167,7 +1167,7 @@ ... on Object { "data": { "unon": { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string" } } @@ -1318,17 +1318,17 @@ ... on Object { "unions": [ { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string" }, { "__typename": "Object", - "id": "2", + "id": "Object:2", "str": "string" }, { "__typename": "Object", - "id": "3", + "id": "Object:3", "str": "string" } ] @@ -1480,13 +1480,13 @@ ... on Object { "unions": [ { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string" }, null, { "__typename": "Object", - "id": "3", + "id": "Object:3", "str": "string" } ] @@ -1551,13 +1551,13 @@ ... on Object { "unions": [ { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string" }, null, { "__typename": "Object", - "id": "3", + "id": "Object:3", "str": "string" } ] @@ -1607,17 +1607,17 @@ ... on Object { "unions": [ { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string" }, { "__typename": "Object", - "id": "2", + "id": "Object:2", "str": null }, { "__typename": "Object", - "id": "3", + "id": "Object:3", "str": "string" } ] @@ -1683,17 +1683,17 @@ ... on Object { "unions": [ { "__typename": "Object", - "id": "1", + "id": "Object:1", "str": "string" }, { "__typename": "Object", - "id": "2", + "id": "Object:2", "str": null }, { "__typename": "Object", - "id": "3", + "id": "Object:3", "str": "string" } ] diff --git a/src/HotChocolate/Fusion/test/Core.Tests/DemoIntegrationTests.cs b/src/HotChocolate/Fusion/test/Core.Tests/DemoIntegrationTests.cs index 35571955ba4..1c27d956d6f 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/DemoIntegrationTests.cs +++ b/src/HotChocolate/Fusion/test/Core.Tests/DemoIntegrationTests.cs @@ -1961,6 +1961,223 @@ query TopProducts { Assert.Null(result.ExpectOperationResult().Errors); } + [Fact] + public async Task BatchExecutionState_With_Multiple_Variable_Values() + { + // arrange + var subgraphA = await TestSubgraph.CreateAsync( + """ + type Query { + node(id: ID!): Node + nodes(ids: [ID!]!): [Node]! + } + + interface Node { + id: ID! + } + + type User implements Node { + id: ID! + displayName: String! + } + """); + var subgraphB = await TestSubgraph.CreateAsync( + """ + type Query { + node(id: ID!): Node + nodes(ids: [ID!]!): [Node]! + userBySlug(slug: String!): User + } + + interface Node { + id: ID! + } + + type User implements Node { + relativeUrl: String! + id: ID! + } + """); + var subgraphC = await TestSubgraph.CreateAsync( + """ + type Query { + node(id: ID!): Node + nodes(ids: [ID!]!): [Node]! + } + + interface Node { + id: ID! + } + + type User implements Node { + id: ID! + feedbacks: FeedbacksConnection + } + + type FeedbacksConnection { + edges: [FeedbacksEdge!] + } + + type FeedbacksEdge { + node: ResaleFeedback! + } + + type ResaleFeedback implements Node { + feedback: ResaleSurveyFeedback + id: ID! + } + + type ResaleSurveyFeedback { + buyer: User + } + """); + + using var subgraphs = new TestSubgraphCollection(output, [subgraphA, subgraphB, subgraphC]); + var executor = await subgraphs.GetExecutorAsync(); + + var request = Parse( + """ + query { + userBySlug(slug: "me") { + feedbacks { + edges { + node { + feedback { + buyer { + relativeUrl + displayName + } + } + } + } + } + } + } + + """); + + // act + await using var result = await executor.ExecuteAsync( + OperationRequestBuilder + .New() + .SetDocument(request) + .Build()); + + // assert + var snapshot = new Snapshot(); + CollectSnapshotData(snapshot, request, result); + await snapshot.MatchMarkdownAsync(); + } + + [Fact] + public async Task BatchExecutionState_With_Multiple_Variable_Values_And_Forwarded_Variable() + { + // arrange + var subgraphA = await TestSubgraph.CreateAsync( + """ + type Query { + node(id: ID!): Node + nodes(ids: [ID!]!): [Node]! + } + + interface Node { + id: ID! + } + + type User implements Node { + id: ID! + displayName(arg: String): String! + } + """); + var subgraphB = await TestSubgraph.CreateAsync( + """ + type Query { + node(id: ID!): Node + nodes(ids: [ID!]!): [Node]! + userBySlug(slug: String!): User + } + + interface Node { + id: ID! + } + + type User implements Node { + relativeUrl(arg: String): String! + id: ID! + } + """); + var subgraphC = await TestSubgraph.CreateAsync( + """ + type Query { + node(id: ID!): Node + nodes(ids: [ID!]!): [Node]! + } + + interface Node { + id: ID! + } + + type User implements Node { + id: ID! + feedbacks: FeedbacksConnection + } + + type FeedbacksConnection { + edges: [FeedbacksEdge!] + } + + type FeedbacksEdge { + node: ResaleFeedback! + } + + type ResaleFeedback implements Node { + feedback: ResaleSurveyFeedback + id: ID! + } + + type ResaleSurveyFeedback { + buyer: User + } + """); + + using var subgraphs = new TestSubgraphCollection(output, [subgraphA, subgraphB, subgraphC]); + var executor = await subgraphs.GetExecutorAsync(); + + var request = Parse( + """ + query($arg1: String, $arg2: String) { + userBySlug(slug: "me") { + feedbacks { + edges { + node { + feedback { + buyer { + relativeUrl(arg: $arg1) + displayName(arg: $arg2) + } + } + } + } + } + } + } + + """); + + // act + await using var result = await executor.ExecuteAsync( + OperationRequestBuilder + .New() + .SetDocument(request) + .SetVariableValues(new Dictionary { ["arg1"] = "abc", ["arg2"] = "def" }) + .Build()); + + // assert + var snapshot = new Snapshot(); + CollectSnapshotData(snapshot, request, result); + await snapshot.MatchMarkdownAsync(); + } + public sealed class HotReloadConfiguration : IObservable { private GatewayConfiguration _configuration; diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values.md new file mode 100644 index 00000000000..6fef2b33f39 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values.md @@ -0,0 +1,173 @@ +# BatchExecutionState_With_Multiple_Variable_Values + +## Result + +```json +{ + "data": { + "userBySlug": { + "feedbacks": { + "edges": [ + { + "node": { + "feedback": { + "buyer": { + "relativeUrl": "string", + "displayName": "string" + } + } + } + }, + { + "node": { + "feedback": { + "buyer": { + "relativeUrl": "string", + "displayName": "string" + } + } + } + }, + { + "node": { + "feedback": { + "buyer": { + "relativeUrl": "string", + "displayName": "string" + } + } + } + } + ] + } + } + } +} +``` + +## Request + +```graphql +{ + userBySlug(slug: "me") { + feedbacks { + edges { + node { + feedback { + buyer { + relativeUrl + displayName + } + } + } + } + } + } +} +``` + +## QueryPlan Hash + +```text +ECA485AE6695B779A8D5B148BC2D37D52EA81380 +``` + +## QueryPlan + +```json +{ + "document": "{ userBySlug(slug: \u0022me\u0022) { feedbacks { edges { node { feedback { buyer { relativeUrl displayName } } } } } } }", + "rootNode": { + "type": "Sequence", + "nodes": [ + { + "type": "Resolve", + "subgraph": "Subgraph_2", + "document": "query fetch_userBySlug_1 { userBySlug(slug: \u0022me\u0022) { __fusion_exports__1: id } }", + "selectionSetId": 0, + "provides": [ + { + "variable": "__fusion_exports__1" + } + ] + }, + { + "type": "Compose", + "selectionSetIds": [ + 0 + ] + }, + { + "type": "Resolve", + "subgraph": "Subgraph_3", + "document": "query fetch_userBySlug_2($__fusion_exports__1: ID!) { node(id: $__fusion_exports__1) { ... on User { feedbacks { edges { node { feedback { buyer { __fusion_exports__3: id } } } } } } } }", + "selectionSetId": 1, + "path": [ + "node" + ], + "requires": [ + { + "variable": "__fusion_exports__1" + } + ], + "provides": [ + { + "variable": "__fusion_exports__3" + } + ] + }, + { + "type": "Compose", + "selectionSetIds": [ + 1 + ] + }, + { + "type": "ResolveByKeyBatch", + "subgraph": "Subgraph_2", + "document": "query fetch_userBySlug_4($__fusion_exports__3: [ID!]!) { nodes(ids: $__fusion_exports__3) { ... on User { relativeUrl __fusion_exports__2: id __fusion_exports__3: id } } }", + "selectionSetId": 6, + "path": [ + "nodes" + ], + "requires": [ + { + "variable": "__fusion_exports__3" + } + ], + "provides": [ + { + "variable": "__fusion_exports__2" + } + ] + }, + { + "type": "ResolveByKeyBatch", + "subgraph": "Subgraph_1", + "document": "query fetch_userBySlug_3($__fusion_exports__2: [ID!]!) { nodes(ids: $__fusion_exports__2) { ... on User { displayName __fusion_exports__2: id } } }", + "selectionSetId": 6, + "path": [ + "nodes" + ], + "requires": [ + { + "variable": "__fusion_exports__2" + } + ] + }, + { + "type": "Compose", + "selectionSetIds": [ + 6 + ] + } + ] + }, + "state": { + "__fusion_exports__1": "User_id", + "__fusion_exports__2": "User_id", + "__fusion_exports__3": "User_id" + } +} +``` + diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_And_Forwarded_Variable.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_And_Forwarded_Variable.md new file mode 100644 index 00000000000..b6ad4c4c87e --- /dev/null +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_And_Forwarded_Variable.md @@ -0,0 +1,183 @@ +# BatchExecutionState_With_Multiple_Variable_Values_And_Forwarded_Variable + +## Result + +```json +{ + "data": { + "userBySlug": { + "feedbacks": { + "edges": [ + { + "node": { + "feedback": { + "buyer": { + "relativeUrl": "string", + "displayName": "string" + } + } + } + }, + { + "node": { + "feedback": { + "buyer": { + "relativeUrl": "string", + "displayName": "string" + } + } + } + }, + { + "node": { + "feedback": { + "buyer": { + "relativeUrl": "string", + "displayName": "string" + } + } + } + } + ] + } + } + } +} +``` + +## Request + +```graphql +query($arg1: String, $arg2: String) { + userBySlug(slug: "me") { + feedbacks { + edges { + node { + feedback { + buyer { + relativeUrl(arg: $arg1) + displayName(arg: $arg2) + } + } + } + } + } + } +} +``` + +## QueryPlan Hash + +```text +B6CBB5EB035C7E54DB6B10176B9A4CB57D6E1DD8 +``` + +## QueryPlan + +```json +{ + "document": "query($arg1: String, $arg2: String) { userBySlug(slug: \u0022me\u0022) { feedbacks { edges { node { feedback { buyer { relativeUrl(arg: $arg1) displayName(arg: $arg2) } } } } } } }", + "rootNode": { + "type": "Sequence", + "nodes": [ + { + "type": "Resolve", + "subgraph": "Subgraph_2", + "document": "query fetch_userBySlug_1 { userBySlug(slug: \u0022me\u0022) { __fusion_exports__1: id } }", + "selectionSetId": 0, + "provides": [ + { + "variable": "__fusion_exports__1" + } + ] + }, + { + "type": "Compose", + "selectionSetIds": [ + 0 + ] + }, + { + "type": "Resolve", + "subgraph": "Subgraph_3", + "document": "query fetch_userBySlug_2($__fusion_exports__1: ID!) { node(id: $__fusion_exports__1) { ... on User { feedbacks { edges { node { feedback { buyer { __fusion_exports__3: id } } } } } } } }", + "selectionSetId": 1, + "path": [ + "node" + ], + "requires": [ + { + "variable": "__fusion_exports__1" + } + ], + "provides": [ + { + "variable": "__fusion_exports__3" + } + ] + }, + { + "type": "Compose", + "selectionSetIds": [ + 1 + ] + }, + { + "type": "ResolveByKeyBatch", + "subgraph": "Subgraph_2", + "document": "query fetch_userBySlug_4($__fusion_exports__3: [ID!]!, $arg1: String) { nodes(ids: $__fusion_exports__3) { ... on User { relativeUrl(arg: $arg1) __fusion_exports__2: id __fusion_exports__3: id } } }", + "selectionSetId": 6, + "path": [ + "nodes" + ], + "requires": [ + { + "variable": "__fusion_exports__3" + } + ], + "provides": [ + { + "variable": "__fusion_exports__2" + } + ], + "forwardedVariables": [ + { + "variable": "arg1" + } + ] + }, + { + "type": "ResolveByKeyBatch", + "subgraph": "Subgraph_1", + "document": "query fetch_userBySlug_3($__fusion_exports__2: [ID!]!, $arg2: String) { nodes(ids: $__fusion_exports__2) { ... on User { displayName(arg: $arg2) __fusion_exports__2: id } } }", + "selectionSetId": 6, + "path": [ + "nodes" + ], + "requires": [ + { + "variable": "__fusion_exports__2" + } + ], + "forwardedVariables": [ + { + "variable": "arg2" + } + ] + }, + { + "type": "Compose", + "selectionSetIds": [ + 6 + ] + } + ] + }, + "state": { + "__fusion_exports__1": "User_id", + "__fusion_exports__2": "User_id", + "__fusion_exports__3": "User_id" + } +} +``` + diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_False.md index f5426c32e1b..e318ec9264b 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_False.md @@ -7,17 +7,17 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "price": 123 }, { - "id": "2", + "id": "Product:2", "name": "string", "price": 123 }, { - "id": "3", + "id": "Product:3", "name": "string", "price": 123 } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_False.md index 4d480171310..38be2ac205f 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_False.md @@ -7,17 +7,17 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "price": 123 }, { - "id": "2", + "id": "Product:2", "name": "string", "price": 123 }, { - "id": "3", + "id": "Product:3", "name": "string", "price": 123 } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_Other_Field_Selected_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_Other_Field_Selected_False.md index 569483256c0..b82e9d0174d 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_Other_Field_Selected_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_Other_Field_Selected_False.md @@ -7,19 +7,19 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "price": 123, "other": "string" }, { - "id": "2", + "id": "Product:2", "name": "string", "price": 123, "other": "string" }, { - "id": "3", + "id": "Product:3", "name": "string", "price": 123, "other": "string" diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_SubField_Selected_Separately.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_SubField_Selected_Separately.md index d5ccd87dcaa..50003b791cd 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_SubField_Selected_Separately.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Fragment_SubField_Selected_Separately.md @@ -7,17 +7,17 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "price": 123 }, { - "id": "2", + "id": "Product:2", "name": "string", "price": 123 }, { - "id": "3", + "id": "Product:3", "name": "string", "price": 123 } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Other_Field_Selected_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Other_Field_Selected_False.md index 8f61678f4d9..0694f507f3c 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Other_Field_Selected_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Other_Field_Selected_False.md @@ -7,19 +7,19 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "price": 123, "other": "string" }, { - "id": "2", + "id": "Product:2", "name": "string", "price": 123, "other": "string" }, { - "id": "3", + "id": "Product:3", "name": "string", "price": 123, "other": "string" diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Other_Field_Selected_True.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Other_Field_Selected_True.md index 88b29c5306b..b0111598116 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Other_Field_Selected_True.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.ResolveByKey_Skip_On_SubField_Other_Field_Selected_True.md @@ -7,17 +7,17 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "other": "string" }, { - "id": "2", + "id": "Product:2", "name": "string", "other": "string" }, { - "id": "3", + "id": "Product:3", "name": "string", "other": "string" } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_False.md index 033fc66519f..1691d31c7b8 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_EntryField_Selected_Separately.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_EntryField_Selected_Separately.md index 2483d68825e..76a2c4a9607 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_EntryField_Selected_Separately.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_EntryField_Selected_Separately.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_False.md index dbd64781d7e..8b984e5788c 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_Other_Field_Selected_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_Other_Field_Selected_False.md index 130c690c005..0d403c4d0be 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_Other_Field_Selected_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Fragment_Other_Field_Selected_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" }, "other": "string" diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Other_Field_Selected_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Other_Field_Selected_False.md index fbca62a4ad9..dffe6e408dd 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Other_Field_Selected_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Other_Field_Selected_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" }, "other": "string" diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Other_Field_Selected_True.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Other_Field_Selected_True.md index 83d93654090..72ecd1db838 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Other_Field_Selected_True.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_Other_Field_Selected_True.md @@ -6,7 +6,7 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "other": "string" } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_True.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_True.md index 7756e29aad1..cc227a75cf5 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_True.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_EntryField_True.md @@ -6,7 +6,7 @@ { "data": { "product": { - "id": "1" + "id": "Product:1" } } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_False.md index 49766b70a88..66c0e74a0fd 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Fragment_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Fragment_False.md index 05d3668e254..9a7f249cd67 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Fragment_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Fragment_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Fragment_Other_RootField_Selected_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Fragment_Other_RootField_Selected_False.md index 3d301d5aed3..5b06b8d8b1e 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Fragment_Other_RootField_Selected_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Fragment_Other_RootField_Selected_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" } }, diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Other_RootField_Selected_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Other_RootField_Selected_False.md index 0bd42e7c758..82d63283132 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Other_RootField_Selected_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_RootField_Other_RootField_Selected_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" } }, diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_False.md index 57c8142f6c6..3985e091364 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_False.md index e7cc0553f77..fbcd6d82f7d 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_Other_Field_Selected_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_Other_Field_Selected_False.md index 04923bb4e45..eafaf43986a 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_Other_Field_Selected_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_Other_Field_Selected_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string", "other": "string" } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_SubField_Selected_Separately.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_SubField_Selected_Separately.md index 39be711a557..ec3ad551f4e 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_SubField_Selected_Separately.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Fragment_SubField_Selected_Separately.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string" } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Other_Field_Selected_False.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Other_Field_Selected_False.md index 487880d07d4..e09cce36941 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Other_Field_Selected_False.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Other_Field_Selected_False.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": "string", "other": "string" } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Other_Field_Selected_True.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Other_Field_Selected_True.md index 01cc70364d6..a7365515ea4 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Other_Field_Selected_True.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SkipTests.Resolve_Sequence_Skip_On_SubField_Other_Field_Selected_True.md @@ -6,9 +6,9 @@ { "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "other": "string" } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_NonNull_ListItem_Nullable_Second_Service_Errors_SubField.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_NonNull_ListItem_Nullable_Second_Service_Errors_SubField.md index cba1a9c8c9c..6bc63096c64 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_NonNull_ListItem_Nullable_Second_Service_Errors_SubField.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_NonNull_ListItem_Nullable_Second_Service_Errors_SubField.md @@ -40,13 +40,13 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "price": 123 }, null, { - "id": "3", + "id": "Product:3", "name": "string", "price": 123 } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Errors_EntryField.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Errors_EntryField.md index a6eca9872ee..5d41240f4b6 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Errors_EntryField.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Errors_EntryField.md @@ -22,17 +22,17 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "price": null }, { - "id": "2", + "id": "Product:2", "name": "string", "price": null }, { - "id": "3", + "id": "Product:3", "name": "string", "price": null } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Errors_SubField.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Errors_SubField.md index 8f930cc9634..1771cf29ba2 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Errors_SubField.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Errors_SubField.md @@ -23,17 +23,17 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "price": 123 }, { - "id": "2", + "id": "Product:2", "name": "string", "price": null }, { - "id": "3", + "id": "Product:3", "name": "string", "price": 123 } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md index cf77283e425..c7cc71720ad 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.ResolveByKey_SubField_Nullable_ListItem_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md @@ -12,17 +12,17 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "price": null }, { - "id": "2", + "id": "Product:2", "name": "string", "price": null }, { - "id": "3", + "id": "Product:3", "name": "string", "price": null } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_One_Service_Errors_EntryField.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_One_Service_Errors_EntryField.md index e3109d9d851..bb7a585687f 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_One_Service_Errors_EntryField.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_One_Service_Errors_EntryField.md @@ -38,7 +38,7 @@ ], "data": { "product": { - "id": "1", + "id": "Product:1", "brand": null } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_One_Service_Errors_SubField.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_One_Service_Errors_SubField.md index 2fffb22d57c..0e4639b97b0 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_One_Service_Errors_SubField.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_One_Service_Errors_SubField.md @@ -22,7 +22,7 @@ ], "data": { "product": { - "id": "1", + "id": "Product:1", "brand": null } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md index 69f7a708462..abe80c66ed6 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_NonNull_Parent_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md @@ -28,7 +28,7 @@ ], "data": { "product": { - "id": "1", + "id": "Product:1", "brand": null } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_One_Service_Errors_EntryField.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_One_Service_Errors_EntryField.md index 5f25db81835..b127213839e 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_One_Service_Errors_EntryField.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_One_Service_Errors_EntryField.md @@ -21,9 +21,9 @@ ], "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": null } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_One_Service_Errors_SubField.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_One_Service_Errors_SubField.md index c51b0a924c9..3078ee9717d 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_One_Service_Errors_SubField.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_One_Service_Errors_SubField.md @@ -22,9 +22,9 @@ ], "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": null } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md index 9cee8f08ad0..8c3611fc122 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/SubgraphErrorTests.Resolve_Sequence_SubField_Nullable_Parent_Nullable_Second_Service_Returns_TopLevel_Error_Without_Data.md @@ -11,9 +11,9 @@ ], "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": null } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.ResolveByKey_Second_Service_Offline_SubField_Nullable.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.ResolveByKey_Second_Service_Offline_SubField_Nullable.md index 032925931ed..fcc9c891609 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.ResolveByKey_Second_Service_Offline_SubField_Nullable.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.ResolveByKey_Second_Service_Offline_SubField_Nullable.md @@ -51,17 +51,17 @@ "data": { "products": [ { - "id": "1", + "id": "Product:1", "name": "string", "price": null }, { - "id": "2", + "id": "Product:2", "name": "string", "price": null }, { - "id": "3", + "id": "Product:3", "name": "string", "price": null } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Node_Second_Service_Offline_SubField_Nullable_Parent_Nullable.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Node_Second_Service_Offline_SubField_Nullable_Parent_Nullable.md index 4231d73351f..e438c6eb8d6 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Node_Second_Service_Offline_SubField_Nullable_Parent_Nullable.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Node_Second_Service_Offline_SubField_Nullable_Parent_Nullable.md @@ -22,9 +22,9 @@ ], "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": null } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Second_Service_Offline_SubField_NonNull_Parent_Nullable.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Second_Service_Offline_SubField_NonNull_Parent_Nullable.md index 76819155651..330f5eaa28e 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Second_Service_Offline_SubField_NonNull_Parent_Nullable.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Second_Service_Offline_SubField_NonNull_Parent_Nullable.md @@ -22,7 +22,7 @@ ], "data": { "product": { - "id": "1", + "id": "Product:1", "brand": null } } diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Second_Service_Offline_SubField_Nullable_Parent_Nullable.md b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Second_Service_Offline_SubField_Nullable_Parent_Nullable.md index 2e35f9f740f..b410feb4a92 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Second_Service_Offline_SubField_Nullable_Parent_Nullable.md +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/TransportErrorTests.Resolve_Sequence_Second_Service_Offline_SubField_Nullable_Parent_Nullable.md @@ -22,9 +22,9 @@ ], "data": { "product": { - "id": "1", + "id": "Product:1", "brand": { - "id": "2", + "id": "Brand:2", "name": null } } diff --git a/src/HotChocolate/Fusion/test/Shared/AutomaticMocking/MockFieldMiddleware.cs b/src/HotChocolate/Fusion/test/Shared/AutomaticMocking/MockFieldMiddleware.cs index 54ac054ac8f..92ed1a5490f 100644 --- a/src/HotChocolate/Fusion/test/Shared/AutomaticMocking/MockFieldMiddleware.cs +++ b/src/HotChocolate/Fusion/test/Shared/AutomaticMocking/MockFieldMiddleware.cs @@ -58,14 +58,11 @@ public ValueTask InvokeAsync(IMiddlewareContext context) { nullIndex = nullDirective.AtIndex; - if (namedFieldType.IsScalarType() || namedFieldType.IsEnumType()) - { var currentListIndex = context.Parent()?.Index; if (currentListIndex.HasValue && currentListIndex == nullIndex) { context.Result = null; return ValueTask.CompletedTask; - } } } else @@ -80,11 +77,13 @@ public ValueTask InvokeAsync(IMiddlewareContext context) if (context.Selection.Arguments.ContainsName("id")) { var id = context.ArgumentValue("id"); + var typeFromId = GetTypeFromId(id); if (namedFieldType.IsCompositeType()) { var possibleTypes = context.Schema.GetPossibleTypes(namedFieldType); - context.ValueType = possibleTypes.First(); + context.ValueType = + possibleTypes.FirstOrDefault(t => t.Name == typeFromId) ?? possibleTypes.First(); context.Result = CreateObject(id); return ValueTask.CompletedTask; } @@ -93,6 +92,7 @@ public ValueTask InvokeAsync(IMiddlewareContext context) if (context.Selection.Arguments.ContainsName("ids")) { var ids = context.ArgumentValue("ids"); + var typeFromId = GetTypeFromId(ids.FirstOrDefault()); IType nullableType = fieldType; if (fieldType.IsNonNullType()) @@ -106,7 +106,8 @@ public ValueTask InvokeAsync(IMiddlewareContext context) { var possibleTypes = context.Schema.GetPossibleTypes(namedFieldType); - context.ValueType = possibleTypes.First(); + context.ValueType = + possibleTypes.FirstOrDefault(t => t.Name == typeFromId) ?? possibleTypes.First(); context.Result = CreateListOfObjects(ids, nullIndex); return ValueTask.CompletedTask; } @@ -132,7 +133,7 @@ public ValueTask InvokeAsync(IMiddlewareContext context) var possibleTypes = context.Schema.GetPossibleTypes(namedFieldType); context.ValueType = possibleTypes.First(); - context.Result = CreateObject(id); + context.Result = CreateObject(id, type: possibleTypes.First()); } else if (fieldType.IsListType()) { @@ -143,7 +144,7 @@ public ValueTask InvokeAsync(IMiddlewareContext context) var possibleTypes = context.Schema.GetPossibleTypes(namedFieldType); context.ValueType = possibleTypes.First(); - context.Result = CreateListOfObjects(ids, nullIndex); + context.Result = CreateListOfObjects(ids, nullIndex, possibleTypes.First()); } else if (namedFieldType is EnumType enumType) { @@ -184,9 +185,11 @@ public ValueTask InvokeAsync(IMiddlewareContext context) return enumType.Values.FirstOrDefault()?.Value; } - private object CreateObject(object? id, int? index = null) + private object CreateObject(object? id, int? index = null, ObjectType? type = null) { - return new ObjectTypeInst(id, index); + var idForType = CreateIdForType(id, type); + + return new ObjectTypeInst(idForType, index); } private object?[] CreateListOfScalars(INamedType scalarType, int? nullIndex, AutomaticMockingContext mockingContext) @@ -203,10 +206,10 @@ private object CreateObject(object? id, int? index = null) .ToArray(); } - private object?[] CreateListOfObjects(object?[] ids, int? nullIndex) + private object?[] CreateListOfObjects(object?[] ids, int? nullIndex, ObjectType? type = null) { return ids - .Select((itemId, index) => nullIndex == index ? null : CreateObject(itemId, index)) + .Select((itemId, index) => nullIndex == index ? null : CreateObject(itemId, index, type)) .ToArray(); } @@ -226,6 +229,31 @@ private static IError CreateError(IResolverContext context, int? index = null) .Build(); } + private static object? CreateIdForType(object? id, ObjectType? type) + { + if (id is null || type is null) + { + return id; + } + + return type.Name + ":" + id; + } + + private static string? GetTypeFromId(object? id) + { + if (id is string idString) + { + var parts = idString.Split(":"); + + if (parts.Length == 2) + { + return parts[0]; + } + } + + return null; + } + private record ObjectTypeInst(object? Id = null, int? Index = null); private class AutomaticMockingContext