From 6bda3c69a3a6ed07fb34615c7d083a585ff9ecdd Mon Sep 17 00:00:00 2001 From: Valentin Bornand Date: Mon, 16 Nov 2026 14:03:59 +0100 Subject: [PATCH 1/2] [Fusion] Keep the errors of value-type fields nulled below a non-value parent --- .../OperationPlanner.BuildExecutionTree.cs | 52 ++- .../SharedPathErrorPocketingTests.cs | 372 ++++++++++++++++++ ...n_Resolve_Field_From_Another_Subgraph.yaml | 4 +- ...tched_Node_Lookups_Executes_Followups.yaml | 4 +- .../ProvidesTests.Provides_On_Interface.yaml | 4 +- ...act_First_Level_Has_No_Type_Condition.yaml | 6 +- ...ion_When_RequirementAnchorIsBelowList.yaml | 4 +- ...equirementIsAnchoredBelowLookupTarget.yaml | 4 +- ...ull_Child_Propagates_To_Shared_Parent.yaml | 197 ++++++++++ ...nd_Nullable_Child_Pockets_Child_Error.yaml | 200 ++++++++++ ...t_Nulled_By_NonNull_Child_Keeps_Error.yaml | 175 ++++++++ ...onNull_Child_Keeps_Error_OnError_Null.yaml | 159 ++++++++ ...l_Child_Keeps_Error_OnError_Propagate.yaml | 158 ++++++++ ...t_Nulled_By_NonNull_Child_Keeps_Error.yaml | 153 +++++++ ...onNull_Child_Keeps_Error_OnError_Null.yaml | 134 +++++++ ...l_Child_Keeps_Error_OnError_Propagate.yaml | 133 +++++++ ..._Parent_Fields_Below_Type_With_Lookup.yaml | 4 +- ...kup_With_Extra_Fields_On_Shared_Level.yaml | 4 +- ...up_With_Extra_Fields_On_Shared_Levels.yaml | 4 +- ...d_Parent_Field_Below_Type_With_Lookup.yaml | 4 +- ...kup_With_Extra_Fields_On_Shared_Level.yaml | 4 +- ...Type_With_Lookup_With_Type_Refinement.yaml | 4 +- ...eviews_And_Products_Query_TopProducts.yaml | 4 +- ...d_Reviews_And_Products_Query_TypeName.yaml | 4 +- ...ts.Authors_And_Reviews_Batch_Requests.yaml | 4 +- ...hors_And_Reviews_Query_GetUserReviews.yaml | 4 +- ...iews_Query_GetUserReviews_Report_Cost.yaml | 4 +- ...iews_Query_GetUserReviews_Skip_Author.yaml | 4 +- ...GetUserReviews_Skip_Author_ErrorField.yaml | 4 +- ...Authors_And_Reviews_Query_ReviewsUser.yaml | 6 +- ...onState_With_Multiple_Variable_Values.yaml | 4 +- ...ariable_Values_And_Forwarded_Variable.yaml | 4 +- ...tiple_Variable_Values_Some_Items_Null.yaml | 4 +- ...ubgraph_Type_Of_Shared_Field_Not_Node.yaml | 4 +- ...graph_Type_Of_Shared_Field_Not_Node_2.yaml | 4 +- ...graph_Type_Of_Shared_Field_Not_Node_3.yaml | 4 +- ...egrationTests.Require_Data_In_Context.yaml | 4 +- ...rationTests.Require_Data_In_Context_2.yaml | 4 +- ...rationTests.Require_Data_In_Context_3.yaml | 4 +- ...at_Require_Data_From_Another_Subgraph.yaml | 4 +- ...a_Is_Available_In_Resolvable_Subgraph.yaml | 4 +- .../RequirementArrivalPathPlanningTests.cs | 10 +- .../Planning/RequirementTests.cs | 4 +- ...ncrete_Fragment_When_Parent_Is_Object.yaml | 6 +- .../EntityChainTests.Complex_Entity_Call.yaml | 4 +- .../FusionBenchmarkTests.Complex_Query.yaml | 6 +- ...arkTests.Conditional_Redundancy_Query.yaml | 6 +- ...mer_Interface_With_Email_Is_Plannable.yaml | 4 +- ...ptationTests.Provides_Nested_Provides.yaml | 4 +- ...FieldBelowIsExternalInReenteredSchema.yaml | 4 +- ...desPlannerTests.Provides_On_Interface.yaml | 4 +- ...ersingPath_When_PathExistsInKeySchema.yaml | 4 +- ...DependsOnEarlierCallOfRequiringSchema.yaml | 6 +- ...DependsOnEarlierCallOfRequiringSchema.yaml | 4 +- ...tedOrParentHasLookup_mutation_doOther.yaml | 4 +- ...rParentHasLookup_subscription_doOther.yaml | 4 +- ...act_First_Level_Has_No_Type_Condition.yaml | 6 +- ...act_First_Level_Has_No_Type_Condition.yaml | 6 +- ...Requires_With_Fragments_On_Interfaces.yaml | 4 +- 59 files changed, 1841 insertions(+), 110 deletions(-) create mode 100644 src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Below_Entity_Null_With_Error_And_NonNull_Child_Propagates_To_Shared_Parent.yaml create mode 100644 src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Below_Entity_Null_With_Error_And_Nullable_Child_Pockets_Child_Error.yaml create mode 100644 src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Interface_Fragment_Nulled_By_NonNull_Child_Keeps_Error.yaml create mode 100644 src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Null.yaml create mode 100644 src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Propagate.yaml create mode 100644 src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_NonNull_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error.yaml create mode 100644 src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Null.yaml create mode 100644 src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Propagate.yaml diff --git a/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs b/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs index d775c345db4..7baf1f534b5 100644 --- a/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs +++ b/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs @@ -3221,13 +3221,17 @@ private static SelectionSetNode PruneNonValueTypeChildren( // reaches an @interfaceObject stand-in, however, the path to that field // must be kept so the result selection set can carry the opacity marker; // recurse to preserve it instead of stripping the whole subtree. + // The path is also kept when the subtree reaches a value-type field, + // because a null with an error on such a field can only be pocketed + // for the fields this node selects below it. if (sourceAliasSelectionSets?.Contains(field.SelectionSet) == true || (fieldNamedType is FusionComplexTypeDefinition complexFieldType && SubtreeContainsOpaqueStandIn( field.SelectionSet, complexFieldType, schema, - sourceSchemaName))) + sourceSchemaName)) + || SubtreeContainsValueType(field.SelectionSet, fieldNamedType, schema)) { var pruned = PruneNonValueTypeChildren( field.SelectionSet, @@ -3417,6 +3421,52 @@ private static bool SubtreeContainsOpaqueStandIn( return false; } + // Reports whether a selection set reaches a field that returns a value type anywhere in its + // subtree. Used to decide whether a non-value field must keep its child selections so the + // result selection set still describes what this node selects below the nested value type. + private static bool SubtreeContainsValueType( + SelectionSetNode selectionSet, + ITypeDefinition parentType, + FusionSchemaDefinition schema) + { + var complexType = parentType as IComplexTypeDefinition; + + foreach (var selection in selectionSet.Selections) + { + if (selection is FieldNode { SelectionSet: not null } field) + { + if (complexType is not null + && complexType.Fields.TryGetField(field.Name.Value, out var fieldDef)) + { + var fieldNamedType = fieldDef.Type.NamedType(); + + if (fieldNamedType is FusionComplexTypeDefinition { IsValueType: true } + || SubtreeContainsValueType(field.SelectionSet, fieldNamedType, schema)) + { + return true; + } + } + } + else if (selection is InlineFragmentNode inlineFragment) + { + var fragmentType = inlineFragment.TypeCondition is not null + && schema.Types.TryGetType( + inlineFragment.TypeCondition.Name.Value, + allowInaccessibleFields: true, + out var resolvedType) + ? resolvedType + : parentType; + + if (SubtreeContainsValueType(inlineFragment.SelectionSet, fragmentType, schema)) + { + return true; + } + } + } + + return false; + } + private static bool DoVariablesContainUploadScalar( IReadOnlyList variables, FusionSchemaDefinition schema) diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/SharedPathErrorPocketingTests.cs b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/SharedPathErrorPocketingTests.cs index 0bdc33826bd..ae4a78e406e 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/SharedPathErrorPocketingTests.cs +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/SharedPathErrorPocketingTests.cs @@ -1,4 +1,5 @@ using System.Text.Json; +using HotChocolate.Language; using HotChocolate.Transport.Http; using OperationRequest = HotChocolate.Transport.OperationRequest; @@ -441,4 +442,375 @@ ... on Review { await MatchSnapshotAsync(gateway, request, result); } + + [Theory] + [InlineData(ErrorHandlingMode.Propagate)] + [InlineData(ErrorHandlingMode.Null)] + public async Task Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error(ErrorHandlingMode onError) + { + using var serverA = CreateSourceSchema( + "A", + """ + type Query { + itemPage: ItemPage + } + + type ItemPage { + items: [Item!] + } + + type Item @shareable { + name: String! @null + } + """); + + using var serverB = CreateSourceSchema( + "B", + """ + type Query { + item: Item + } + + type Item @shareable { + name: String! + } + """); + + using var gateway = await CreateCompositeSchemaAsync( + [ + ("A", serverA), + ("B", serverB) + ]); + + using var client = GraphQLHttpClient.Create(gateway.CreateClient()); + var request = new OperationRequest( + """ + { + itemPage { + items { + name + } + } + } + """, + onError: onError); + + using var result = await client.PostAsync( + request, + new Uri("http://localhost:5000/graphql"), + TestContext.Current.CancellationToken); + + await MatchSnapshotAsync(gateway, request, result, postFix: "OnError_" + onError); + } + + [Fact] + public async Task Shared_Value_Type_NonNull_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error() + { + using var serverA = CreateSourceSchema( + "A", + """ + type Query { + itemPage: ItemPage + } + + type ItemPage { + items: [Item!]! + } + + type Item @shareable { + name: String! @null + } + """); + + using var serverB = CreateSourceSchema( + "B", + """ + type Query { + item: Item + } + + type Item @shareable { + name: String! + } + """); + + using var gateway = await CreateCompositeSchemaAsync( + [ + ("A", serverA), + ("B", serverB) + ]); + + using var client = GraphQLHttpClient.Create(gateway.CreateClient()); + var request = new OperationRequest( + """ + { + itemPage { + items { + name + } + } + } + """); + + using var result = await client.PostAsync( + request, + new Uri("http://localhost:5000/graphql"), + TestContext.Current.CancellationToken); + + await MatchSnapshotAsync(gateway, request, result); + } + + [Theory] + [InlineData(ErrorHandlingMode.Propagate)] + [InlineData(ErrorHandlingMode.Null)] + public async Task Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error(ErrorHandlingMode onError) + { + using var serverA = CreateSourceSchema( + "A", + """ + type Query { + itemPage: ItemPage + } + + type ItemPage { + item: Item + } + + type Item @shareable { + name: String! @null + } + """); + + using var serverB = CreateSourceSchema( + "B", + """ + type Query { + item: Item + } + + type Item @shareable { + name: String! + } + """); + + using var gateway = await CreateCompositeSchemaAsync( + [ + ("A", serverA), + ("B", serverB) + ]); + + using var client = GraphQLHttpClient.Create(gateway.CreateClient()); + var request = new OperationRequest( + """ + { + itemPage { + item { + name + } + } + } + """, + onError: onError); + + using var result = await client.PostAsync( + request, + new Uri("http://localhost:5000/graphql"), + TestContext.Current.CancellationToken); + + await MatchSnapshotAsync(gateway, request, result, postFix: "OnError_" + onError); + } + + [Fact] + public async Task Shared_Value_Type_Below_Entity_Null_With_Error_And_Nullable_Child_Pockets_Child_Error() + { + using var serverA = CreateSourceSchema( + "A", + """ + type Query { + product: Product + productA(id: Int!): Product @lookup + } + + type Product @key(fields: "id") { + id: Int! + shared: SharedData @shareable @error + } + + type SharedData @shareable { + a: String + } + """); + + using var serverB = CreateSourceSchema( + "B", + """ + type Query { + productB(id: Int!): Product @lookup + } + + type Product @key(fields: "id") { + id: Int! + shared: SharedData @shareable + } + + type SharedData @shareable { + b: String + } + """); + + using var gateway = await CreateCompositeSchemaAsync( + [ + ("A", serverA), + ("B", serverB) + ]); + + using var client = GraphQLHttpClient.Create(gateway.CreateClient()); + var request = new OperationRequest( + """ + { + product { + shared { + a + b + } + } + } + """); + + using var result = await client.PostAsync( + request, + new Uri("http://localhost:5000/graphql"), + TestContext.Current.CancellationToken); + + await MatchSnapshotAsync(gateway, request, result); + } + + [Fact] + public async Task Shared_Value_Type_Below_Entity_Null_With_Error_And_NonNull_Child_Propagates_To_Shared_Parent() + { + using var serverA = CreateSourceSchema( + "A", + """ + type Query { + product: Product + productA(id: Int!): Product @lookup + } + + type Product @key(fields: "id") { + id: Int! + shared: SharedData @shareable @error + } + + type SharedData @shareable { + a: String! + } + """); + + using var serverB = CreateSourceSchema( + "B", + """ + type Query { + productB(id: Int!): Product @lookup + } + + type Product @key(fields: "id") { + id: Int! + shared: SharedData @shareable + } + + type SharedData @shareable { + b: String + } + """); + + using var gateway = await CreateCompositeSchemaAsync( + [ + ("A", serverA), + ("B", serverB) + ]); + + using var client = GraphQLHttpClient.Create(gateway.CreateClient()); + var request = new OperationRequest( + """ + { + product { + shared { + a + b + } + } + } + """); + + using var result = await client.PostAsync( + request, + new Uri("http://localhost:5000/graphql"), + TestContext.Current.CancellationToken); + + await MatchSnapshotAsync(gateway, request, result); + } + + [Fact] + public async Task Shared_Value_Type_List_Below_Unshared_Interface_Fragment_Nulled_By_NonNull_Child_Keeps_Error() + { + using var serverA = CreateSourceSchema( + "A", + """ + type Query { + page: Page + } + + interface Page { + id: Int! + } + + type ItemPage implements Page { + id: Int! + items: [Item!] + } + + type Item @shareable { + name: String! @null + } + """); + + using var serverB = CreateSourceSchema( + "B", + """ + type Query { + item: Item + } + + type Item @shareable { + name: String! + } + """); + + using var gateway = await CreateCompositeSchemaAsync( + [ + ("A", serverA), + ("B", serverB) + ]); + + using var client = GraphQLHttpClient.Create(gateway.CreateClient()); + var request = new OperationRequest( + """ + { + page { + ... on ItemPage { + items { + name + } + } + } + } + """); + + using var result = await client.PostAsync( + request, + new Uri("http://localhost:5000/graphql"), + TestContext.Current.CancellationToken); + + await MatchSnapshotAsync(gateway, request, result); + } } diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/Issue7996Tests.Mutation_Returned_Viewer_Can_Resolve_Field_From_Another_Subgraph.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/Issue7996Tests.Mutation_Returned_Viewer_Can_Resolve_Field_From_Another_Subgraph.yaml index d1ae588bfe3..60073d7f469 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/Issue7996Tests.Mutation_Returned_Viewer_Can_Resolve_Field_From_Another_Subgraph.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/Issue7996Tests.Mutation_Returned_Viewer_Can_Resolve_Field_From_Another_Subgraph.yaml @@ -107,7 +107,7 @@ sourceSchemas: } } operationPlan: - id: ec4d7a3a1a29f23f792b2fbe4926a29a27e82f39e361a28f3e19b7739085d79a + id: 1d6be441b493b5b5df8aa081ff0251c794fa2de4dbbc55f7dbf901abf85cb784 operation: - document: | mutation { @@ -145,7 +145,7 @@ operationPlan: shortHash: 7c0f0f6f xxHash: 15511957333164797700 resultSelectionSet: >- - { doSomething } + { doSomething { something viewer { subgraphA } } } - id: 2 type: Operation schema: B diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/MutationTests.Mutation_Root_With_Batched_Node_Lookups_Executes_Followups.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/MutationTests.Mutation_Root_With_Batched_Node_Lookups_Executes_Followups.yaml index d6f63f24c38..6806eca8c6a 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/MutationTests.Mutation_Root_With_Batched_Node_Lookups_Executes_Followups.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/MutationTests.Mutation_Root_With_Batched_Node_Lookups_Executes_Followups.yaml @@ -192,7 +192,7 @@ sourceSchemas: } } operationPlan: - id: e7e6a0f82c4dd657db5d6dcaab7faad5160211425c39b18bf6f9bc3076f57cb8 + id: 749f926e8a1e1a056215d33e55b45b222ab61fc678ed7bb5419fa8624417ce6a operation: - document: | mutation createReview($input: CreateReviewInput!) { @@ -242,7 +242,7 @@ operationPlan: shortHash: d3c6fca2 xxHash: 7735658392071352531 resultSelectionSet: >- - { createReview } + { createReview { id body author { id } product { id } } } forwardedVariables: - input - id: 2 diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/ProvidesTests.Provides_On_Interface.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/ProvidesTests.Provides_On_Interface.yaml index 7209b4ebef2..2bd4d0a9bcd 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/ProvidesTests.Provides_On_Interface.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/ProvidesTests.Provides_On_Interface.yaml @@ -108,7 +108,7 @@ sourceSchemas: id: ID! } operationPlan: - id: 9aedff646ff839fc9d0ec53ad45463a2f4c0da9f12f62890963bc1cf6f8b1c6d + id: bcda189169e4d0411e64b15f1f6030db061100830e428ec7cb2b191f9c4d587c operation: - document: | { @@ -155,4 +155,4 @@ operationPlan: shortHash: b744b7dd xxHash: 17948994167229189567 resultSelectionSet: >- - { book } + { book { featured { __typename ... on Cat { age } ... on Dog { tricks } } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_Reenter_Requiring_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_Reenter_Requiring_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml index 812e2691b27..c4a8b8b25e7 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_Reenter_Requiring_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_Reenter_Requiring_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml @@ -241,7 +241,7 @@ sourceSchemas: } } operationPlan: - id: b27f4cb43555eedcd311fbcada873340c21e24071d1ee8e36f5aca22f2093e67 + id: 10b70c67a4f3786ff760deff7cd31eefaa3d0eb6a767d41700d895fd749b36c6 operation: - document: | { @@ -344,7 +344,7 @@ operationPlan: shortHash: 5e20430c xxHash: 466061709385306516 resultSelectionSet: >- - { orders } + { orders { id customer { __typename } } } batchingGroupId: 5 - id: 4 type: Operation @@ -367,5 +367,5 @@ operationPlan: shortHash: 2921cdd5 xxHash: 3193713425186979845 resultSelectionSet: >- - { orders } + { orders { customer { __typename ... on Customer { id } } } } batchingGroupId: 5 diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_ResolveBatchedOperation_When_RequirementAnchorIsBelowList.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_ResolveBatchedOperation_When_RequirementAnchorIsBelowList.yaml index 3a02b561e3a..8d04609f2f8 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_ResolveBatchedOperation_When_RequirementAnchorIsBelowList.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_ResolveBatchedOperation_When_RequirementAnchorIsBelowList.yaml @@ -193,7 +193,7 @@ sourceSchemas: } } operationPlan: - id: 9f7e3056d47c5d2cd3b557c5f1086b0f50d0da25652ad0e3c65b4e4c7858386f + id: 2d43fab8e8e47ed636cd1f64e7c56dad2cbf671e9f1d813c44ba619c91db38bb operation: - document: | { @@ -240,7 +240,7 @@ operationPlan: shortHash: e57cde1f xxHash: 3360290498109568757 resultSelectionSet: >- - { products reviews } + { products { id variants { weight } } reviews } - id: 2 type: Operation schema: b diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_ResolveRequiringField_When_RequirementIsAnchoredBelowLookupTarget.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_ResolveRequiringField_When_RequirementIsAnchoredBelowLookupTarget.yaml index b8a03ce60c8..c8bc3d97374 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_ResolveRequiringField_When_RequirementIsAnchoredBelowLookupTarget.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/RequireCrossProviderTests.Execute_Should_ResolveRequiringField_When_RequirementIsAnchoredBelowLookupTarget.yaml @@ -153,7 +153,7 @@ sourceSchemas: } } operationPlan: - id: 85e59401cd9d53b8be8f5035ad05144e877800749ad06e5c8bd80290faf086c8 + id: cd7708f08c4fea1accca6aeae12866a2a1cd80a9dbac54b4f0bbe8462f75cc5d operation: - document: | { @@ -192,7 +192,7 @@ operationPlan: shortHash: ed128227 xxHash: 10505008707333797213 resultSelectionSet: >- - { products } + { products { id details { weight } } } - id: 2 type: Operation schema: b diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Below_Entity_Null_With_Error_And_NonNull_Child_Propagates_To_Shared_Parent.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Below_Entity_Null_With_Error_And_NonNull_Child_Propagates_To_Shared_Parent.yaml new file mode 100644 index 00000000000..751494464e1 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Below_Entity_Null_With_Error_And_NonNull_Child_Propagates_To_Shared_Parent.yaml @@ -0,0 +1,197 @@ +title: Shared_Value_Type_Below_Entity_Null_With_Error_And_NonNull_Child_Propagates_To_Shared_Parent +request: + document: | + { + product { + shared { + a + b + } + } + } +response: + body: | + { + "data": { + "product": { + "shared": null + } + }, + "errors": [ + { + "message": "Unexpected Execution Error", + "path": [ + "product", + "shared", + "a" + ] + } + ] + } +sourceSchemas: + - name: A + schema: | + schema { + query: Query + } + + type Query { + product: Product + productA(id: Int!): Product @lookup + } + + type Product @key(fields: "id") { + id: Int! + shared: SharedData @shareable @error + } + + type SharedData @shareable { + a: String! + } + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_88539581_1 { + product { + shared { + a + } + id + } + } + response: + results: + - | + { + "errors": [ + { + "message": "Unexpected Execution Error", + "path": [ + "product", + "shared" + ] + } + ], + "data": { + "product": { + "shared": null, + "id": 123 + } + } + } + - name: B + schema: | + schema { + query: Query + } + + type Query { + productB(id: Int!): Product @lookup + } + + type Product @key(fields: "id") { + id: Int! + shared: SharedData @shareable + } + + type SharedData @shareable { + b: String + } + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_88539581_2($__fusion_1_id: Int!) { + productB(id: $__fusion_1_id) { + shared { + b + } + } + } + variables: | + { + "__fusion_1_id": 123 + } + response: + results: + - | + { + "data": { + "productB": { + "shared": { + "b": "SharedData: U2hhcmVkRGF0YTozNDk2OTYwNTA1" + } + } + } + } +operationPlan: + id: be2d130d8c808627df62d96e8e26dc2a5b8feb4d252045afb23a6fe8f1785a94 + operation: + - document: | + { + product { + shared { + a + b + } + id @fusion__requirement + } + } + kind: Query + id: 28a8e75b565f67068aab148eb4356936 + hash: 88539581d9b1420db2462456cfd14401 + shortHash: "88539581" + searchSpace: 1 + expandedNodes: 2 + nodes: + - id: 1 + type: Operation + schema: A + operation: + name: Op_88539581_1 + kind: Query + document: | + query Op_88539581_1 { + product { + shared { + a + } + id + } + } + hash: 06db38c56dd944efaf2eb85b309e2e40729023a59fdb04d11a662d542e5ab92e + shortHash: 06db38c5 + xxHash: 3308987444842917395 + resultSelectionSet: >- + { product { shared { a } id } } + - id: 2 + type: Operation + schema: B + operation: + name: Op_88539581_2 + kind: Query + document: | + query Op_88539581_2($__fusion_1_id: Int!) { + productB(id: $__fusion_1_id) { + shared { + b + } + } + } + hash: d9b1a58af72e336c111c30b3f2bae7919ecf937eb2cb2fd511b185a390e20553 + shortHash: d9b1a58a + xxHash: 11257255903879648510 + lookupTypeName: Product + resultSelectionSet: >- + { shared { b } } + source: $.productB + target: $.product + requirements: + - name: __fusion_1_id + type: Int! + path: $.product + selectionMap: >- + id + dependencies: + - id: 1 diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Below_Entity_Null_With_Error_And_Nullable_Child_Pockets_Child_Error.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Below_Entity_Null_With_Error_And_Nullable_Child_Pockets_Child_Error.yaml new file mode 100644 index 00000000000..48a7a6392e6 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Below_Entity_Null_With_Error_And_Nullable_Child_Pockets_Child_Error.yaml @@ -0,0 +1,200 @@ +title: Shared_Value_Type_Below_Entity_Null_With_Error_And_Nullable_Child_Pockets_Child_Error +request: + document: | + { + product { + shared { + a + b + } + } + } +response: + body: | + { + "data": { + "product": { + "shared": { + "a": null, + "b": "SharedData: U2hhcmVkRGF0YTozNDk2OTYwNTA1" + } + } + }, + "errors": [ + { + "message": "Unexpected Execution Error", + "path": [ + "product", + "shared", + "a" + ] + } + ] + } +sourceSchemas: + - name: A + schema: | + schema { + query: Query + } + + type Query { + product: Product + productA(id: Int!): Product @lookup + } + + type Product @key(fields: "id") { + id: Int! + shared: SharedData @shareable @error + } + + type SharedData @shareable { + a: String + } + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_88539581_1 { + product { + shared { + a + } + id + } + } + response: + results: + - | + { + "errors": [ + { + "message": "Unexpected Execution Error", + "path": [ + "product", + "shared" + ] + } + ], + "data": { + "product": { + "shared": null, + "id": 123 + } + } + } + - name: B + schema: | + schema { + query: Query + } + + type Query { + productB(id: Int!): Product @lookup + } + + type Product @key(fields: "id") { + id: Int! + shared: SharedData @shareable + } + + type SharedData @shareable { + b: String + } + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_88539581_2($__fusion_1_id: Int!) { + productB(id: $__fusion_1_id) { + shared { + b + } + } + } + variables: | + { + "__fusion_1_id": 123 + } + response: + results: + - | + { + "data": { + "productB": { + "shared": { + "b": "SharedData: U2hhcmVkRGF0YTozNDk2OTYwNTA1" + } + } + } + } +operationPlan: + id: be2d130d8c808627df62d96e8e26dc2a5b8feb4d252045afb23a6fe8f1785a94 + operation: + - document: | + { + product { + shared { + a + b + } + id @fusion__requirement + } + } + kind: Query + id: 28a8e75b565f67068aab148eb4356936 + hash: 88539581d9b1420db2462456cfd14401 + shortHash: "88539581" + searchSpace: 1 + expandedNodes: 2 + nodes: + - id: 1 + type: Operation + schema: A + operation: + name: Op_88539581_1 + kind: Query + document: | + query Op_88539581_1 { + product { + shared { + a + } + id + } + } + hash: 06db38c56dd944efaf2eb85b309e2e40729023a59fdb04d11a662d542e5ab92e + shortHash: 06db38c5 + xxHash: 3308987444842917395 + resultSelectionSet: >- + { product { shared { a } id } } + - id: 2 + type: Operation + schema: B + operation: + name: Op_88539581_2 + kind: Query + document: | + query Op_88539581_2($__fusion_1_id: Int!) { + productB(id: $__fusion_1_id) { + shared { + b + } + } + } + hash: d9b1a58af72e336c111c30b3f2bae7919ecf937eb2cb2fd511b185a390e20553 + shortHash: d9b1a58a + xxHash: 11257255903879648510 + lookupTypeName: Product + resultSelectionSet: >- + { shared { b } } + source: $.productB + target: $.product + requirements: + - name: __fusion_1_id + type: Int! + path: $.product + selectionMap: >- + id + dependencies: + - id: 1 diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Interface_Fragment_Nulled_By_NonNull_Child_Keeps_Error.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Interface_Fragment_Nulled_By_NonNull_Child_Keeps_Error.yaml new file mode 100644 index 00000000000..0bae7917bc8 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Interface_Fragment_Nulled_By_NonNull_Child_Keeps_Error.yaml @@ -0,0 +1,175 @@ +title: Shared_Value_Type_List_Below_Unshared_Interface_Fragment_Nulled_By_NonNull_Child_Keeps_Error +request: + document: | + { + page { + ... on ItemPage { + items { + name + } + } + } + } +response: + body: | + { + "data": { + "page": { + "items": null + } + }, + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "page", + "items" + ], + "extensions": { + "code": "HC0018" + } + } + ] + } +sourceSchemas: + - name: A + schema: | + schema { + query: Query + } + + type Query { + page: Page + } + + type Item @shareable { + name: String! @null + } + + type ItemPage implements Page { + id: Int! + items: [Item!] + } + + interface Page { + id: Int! + } + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_e8a05eb1_1 { + page { + __typename + ... on ItemPage { + items { + name + } + } + } + } + response: + results: + - | + { + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "page", + "items", + 0, + "name" + ], + "extensions": { + "code": "HC0018" + } + }, + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "page", + "items", + 1, + "name" + ], + "extensions": { + "code": "HC0018" + } + }, + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "page", + "items", + 2, + "name" + ], + "extensions": { + "code": "HC0018" + } + } + ], + "data": { + "page": { + "__typename": "ItemPage", + "items": null + } + } + } + - name: B + schema: | + schema { + query: Query + } + + type Query { + item: Item + } + + type Item @shareable { + name: String! + } +operationPlan: + id: b13815d3578e0b7c6e51832502fec4e6703deffa4cf38ecf9892a7b778a1c789 + operation: + - document: | + { + page { + __typename @fusion__requirement + ... on ItemPage { + items { + name + } + } + } + } + kind: Query + id: 67f0656af81ff91d9c083f63200e95dd + hash: e8a05eb1c75789743e648e584e6dbca8 + shortHash: e8a05eb1 + searchSpace: 1 + expandedNodes: 1 + nodes: + - id: 1 + type: Operation + schema: A + operation: + name: Op_e8a05eb1_1 + kind: Query + document: | + query Op_e8a05eb1_1 { + page { + __typename + ... on ItemPage { + items { + name + } + } + } + } + hash: 7c2c2884eadc4f94b4c7d1a0bff2527c90b32463ec8571a3b237c21963409522 + shortHash: 7c2c2884 + xxHash: 14497771971186834526 + resultSelectionSet: >- + { page { __typename ... on ItemPage { items { name } } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Null.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Null.yaml new file mode 100644 index 00000000000..ca34786d404 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Null.yaml @@ -0,0 +1,159 @@ +title: Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error +request: + onError: Null + document: | + { + itemPage { + items { + name + } + } + } +response: + body: | + { + "data": { + "itemPage": { + "items": null + } + }, + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items" + ], + "extensions": { + "code": "HC0018" + } + } + ] + } +sourceSchemas: + - name: A + schema: | + schema { + query: Query + } + + type Query { + itemPage: ItemPage + } + + type Item @shareable { + name: String! @null + } + + type ItemPage { + items: [Item!] + } + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_fa38cf00_1 { + itemPage { + items { + name + } + } + } + response: + results: + - | + { + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items", + 0, + "name" + ], + "extensions": { + "code": "HC0018" + } + }, + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items", + 1, + "name" + ], + "extensions": { + "code": "HC0018" + } + }, + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items", + 2, + "name" + ], + "extensions": { + "code": "HC0018" + } + } + ], + "data": { + "itemPage": { + "items": null + } + } + } + - name: B + schema: | + schema { + query: Query + } + + type Query { + item: Item + } + + type Item @shareable { + name: String! + } +operationPlan: + id: fd0749f3fe4cfdd8e7c0b3e1d8b5c1cc20f14628a14bf623767b1a65943d1322 + operation: + - document: | + { + itemPage { + items { + name + } + } + } + kind: Query + id: 69eb61217c27895a69bf0a37847b3c72 + hash: fa38cf00aa99be1a8ff821c272e00012 + shortHash: fa38cf00 + searchSpace: 1 + expandedNodes: 1 + nodes: + - id: 1 + type: Operation + schema: A + operation: + name: Op_fa38cf00_1 + kind: Query + document: | + query Op_fa38cf00_1 { + itemPage { + items { + name + } + } + } + hash: e0ef6e75eb9872a443c8259c9cd90819c9827f9a6cfa2aa6bb0751af2907aa71 + shortHash: e0ef6e75 + xxHash: 9203918949081113744 + resultSelectionSet: >- + { itemPage { items { name } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Propagate.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Propagate.yaml new file mode 100644 index 00000000000..75e9502ae09 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Propagate.yaml @@ -0,0 +1,158 @@ +title: Shared_Value_Type_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error +request: + document: | + { + itemPage { + items { + name + } + } + } +response: + body: | + { + "data": { + "itemPage": { + "items": null + } + }, + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items" + ], + "extensions": { + "code": "HC0018" + } + } + ] + } +sourceSchemas: + - name: A + schema: | + schema { + query: Query + } + + type Query { + itemPage: ItemPage + } + + type Item @shareable { + name: String! @null + } + + type ItemPage { + items: [Item!] + } + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_fa38cf00_1 { + itemPage { + items { + name + } + } + } + response: + results: + - | + { + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items", + 0, + "name" + ], + "extensions": { + "code": "HC0018" + } + }, + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items", + 1, + "name" + ], + "extensions": { + "code": "HC0018" + } + }, + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items", + 2, + "name" + ], + "extensions": { + "code": "HC0018" + } + } + ], + "data": { + "itemPage": { + "items": null + } + } + } + - name: B + schema: | + schema { + query: Query + } + + type Query { + item: Item + } + + type Item @shareable { + name: String! + } +operationPlan: + id: fd0749f3fe4cfdd8e7c0b3e1d8b5c1cc20f14628a14bf623767b1a65943d1322 + operation: + - document: | + { + itemPage { + items { + name + } + } + } + kind: Query + id: 69eb61217c27895a69bf0a37847b3c72 + hash: fa38cf00aa99be1a8ff821c272e00012 + shortHash: fa38cf00 + searchSpace: 1 + expandedNodes: 1 + nodes: + - id: 1 + type: Operation + schema: A + operation: + name: Op_fa38cf00_1 + kind: Query + document: | + query Op_fa38cf00_1 { + itemPage { + items { + name + } + } + } + hash: e0ef6e75eb9872a443c8259c9cd90819c9827f9a6cfa2aa6bb0751af2907aa71 + shortHash: e0ef6e75 + xxHash: 9203918949081113744 + resultSelectionSet: >- + { itemPage { items { name } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_NonNull_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_NonNull_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error.yaml new file mode 100644 index 00000000000..594886a55fb --- /dev/null +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_NonNull_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error.yaml @@ -0,0 +1,153 @@ +title: Shared_Value_Type_NonNull_List_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error +request: + document: | + { + itemPage { + items { + name + } + } + } +response: + body: | + { + "data": { + "itemPage": null + }, + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage" + ], + "extensions": { + "code": "HC0018" + } + } + ] + } +sourceSchemas: + - name: A + schema: | + schema { + query: Query + } + + type Query { + itemPage: ItemPage + } + + type Item @shareable { + name: String! @null + } + + type ItemPage { + items: [Item!]! + } + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_fa38cf00_1 { + itemPage { + items { + name + } + } + } + response: + results: + - | + { + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items", + 0, + "name" + ], + "extensions": { + "code": "HC0018" + } + }, + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items", + 1, + "name" + ], + "extensions": { + "code": "HC0018" + } + }, + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "items", + 2, + "name" + ], + "extensions": { + "code": "HC0018" + } + } + ], + "data": { + "itemPage": null + } + } + - name: B + schema: | + schema { + query: Query + } + + type Query { + item: Item + } + + type Item @shareable { + name: String! + } +operationPlan: + id: fd0749f3fe4cfdd8e7c0b3e1d8b5c1cc20f14628a14bf623767b1a65943d1322 + operation: + - document: | + { + itemPage { + items { + name + } + } + } + kind: Query + id: 69eb61217c27895a69bf0a37847b3c72 + hash: fa38cf00aa99be1a8ff821c272e00012 + shortHash: fa38cf00 + searchSpace: 1 + expandedNodes: 1 + nodes: + - id: 1 + type: Operation + schema: A + operation: + name: Op_fa38cf00_1 + kind: Query + document: | + query Op_fa38cf00_1 { + itemPage { + items { + name + } + } + } + hash: e0ef6e75eb9872a443c8259c9cd90819c9827f9a6cfa2aa6bb0751af2907aa71 + shortHash: e0ef6e75 + xxHash: 9203918949081113744 + resultSelectionSet: >- + { itemPage { items { name } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Null.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Null.yaml new file mode 100644 index 00000000000..0882a85eba4 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Null.yaml @@ -0,0 +1,134 @@ +title: Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error +request: + onError: Null + document: | + { + itemPage { + item { + name + } + } + } +response: + body: | + { + "data": { + "itemPage": { + "item": null + } + }, + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "item" + ], + "extensions": { + "code": "HC0018" + } + } + ] + } +sourceSchemas: + - name: A + schema: | + schema { + query: Query + } + + type Query { + itemPage: ItemPage + } + + type Item @shareable { + name: String! @null + } + + type ItemPage { + item: Item + } + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_cee47676_1 { + itemPage { + item { + name + } + } + } + response: + results: + - | + { + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "item", + "name" + ], + "extensions": { + "code": "HC0018" + } + } + ], + "data": { + "itemPage": { + "item": null + } + } + } + - name: B + schema: | + schema { + query: Query + } + + type Query { + item: Item + } + + type Item @shareable { + name: String! + } +operationPlan: + id: e986cede5e2c1b10212a910a3be8535b7e24bac9d7c308c0f62ed14351ff3edd + operation: + - document: | + { + itemPage { + item { + name + } + } + } + kind: Query + id: aae4131e64064d41af2ee5e10f100b78 + hash: cee47676d844b30d0f5d4e139d558060 + shortHash: cee47676 + searchSpace: 1 + expandedNodes: 1 + nodes: + - id: 1 + type: Operation + schema: A + operation: + name: Op_cee47676_1 + kind: Query + document: | + query Op_cee47676_1 { + itemPage { + item { + name + } + } + } + hash: 66199b7b0174e78c4949c1ff910b3772411deeaeb9f76b97fcddfb49d0d5ee54 + shortHash: 66199b7b + xxHash: 7894074533134351530 + resultSelectionSet: >- + { itemPage { item { name } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Propagate.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Propagate.yaml new file mode 100644 index 00000000000..50583048d29 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error_OnError_Propagate.yaml @@ -0,0 +1,133 @@ +title: Shared_Value_Type_Object_Below_Unshared_Parent_Nulled_By_NonNull_Child_Keeps_Error +request: + document: | + { + itemPage { + item { + name + } + } + } +response: + body: | + { + "data": { + "itemPage": { + "item": null + } + }, + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "item" + ], + "extensions": { + "code": "HC0018" + } + } + ] + } +sourceSchemas: + - name: A + schema: | + schema { + query: Query + } + + type Query { + itemPage: ItemPage + } + + type Item @shareable { + name: String! @null + } + + type ItemPage { + item: Item + } + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_cee47676_1 { + itemPage { + item { + name + } + } + } + response: + results: + - | + { + "errors": [ + { + "message": "Cannot return null for non-nullable field.", + "path": [ + "itemPage", + "item", + "name" + ], + "extensions": { + "code": "HC0018" + } + } + ], + "data": { + "itemPage": { + "item": null + } + } + } + - name: B + schema: | + schema { + query: Query + } + + type Query { + item: Item + } + + type Item @shareable { + name: String! + } +operationPlan: + id: e986cede5e2c1b10212a910a3be8535b7e24bac9d7c308c0f62ed14351ff3edd + operation: + - document: | + { + itemPage { + item { + name + } + } + } + kind: Query + id: aae4131e64064d41af2ee5e10f100b78 + hash: cee47676d844b30d0f5d4e139d558060 + shortHash: cee47676 + searchSpace: 1 + expandedNodes: 1 + nodes: + - id: 1 + type: Operation + schema: A + operation: + name: Op_cee47676_1 + kind: Query + document: | + query Op_cee47676_1 { + itemPage { + item { + name + } + } + } + hash: 66199b7b0174e78c4949c1ff910b3772411deeaeb9f76b97fcddfb49d0d5ee54 + shortHash: 66199b7b + xxHash: 7894074533134351530 + resultSelectionSet: >- + { itemPage { item { name } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup.yaml index 9190838549a..b926bddb774 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup.yaml @@ -190,7 +190,7 @@ sourceSchemas: } } operationPlan: - id: 9587e2eac7bc8a20a058af117a43c611fac74b37a540f1fc1213817d69e213e3 + id: 8d740abf50fb01ee8944e64b0d9969de1b541ec4138d912b16cf69e9ae4b943a operation: - document: | { @@ -232,7 +232,7 @@ operationPlan: shortHash: 80497d44 xxHash: 6565406871173101600 resultSelectionSet: >- - { productById } + { productById { shared { shared2 { schema1 } } id } } - id: 2 type: Operation schema: B diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Level.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Level.yaml index 454362e2aca..4c70ff09a8a 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Level.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Level.yaml @@ -221,7 +221,7 @@ sourceSchemas: } } operationPlan: - id: e798250306cef2be020ac99adeb0fe156999d7603b7133f0900c9ce4a2da2f92 + id: f48f964d3d3d53fd6ebd394e42528379f532603a519fcb608b8fae5811210721 operation: - document: | { @@ -266,7 +266,7 @@ operationPlan: shortHash: a4fa6575 xxHash: 101421477287483317 resultSelectionSet: >- - { productById } + { productById { shared { schema1 shared2 { schema1 } } id } } - id: 2 type: Operation schema: B diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Levels.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Levels.yaml index 389d9474a1a..19deba8efb8 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Levels.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Hierarchy_Of_Shared_Parent_Fields_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Levels.yaml @@ -245,7 +245,7 @@ sourceSchemas: } } operationPlan: - id: fc79b598cf7dc90c01167d10d6f9cb537f4e0939a7c3a19640113deb602eb263 + id: db361888a76a1ee8c7e593b3410bd52fb41d897a57ec5f41c378f7bb89839857 operation: - document: | { @@ -293,7 +293,7 @@ operationPlan: shortHash: b17dbc2f xxHash: 1547003635357508194 resultSelectionSet: >- - { productById } + { productById { schema1 shared { schema1 shared2 { schema1 } } id } } - id: 2 type: Operation schema: B diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup.yaml index 69659c5a6e2..38b21918218 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup.yaml @@ -178,7 +178,7 @@ sourceSchemas: } } operationPlan: - id: a4ecd2d4d3f61f0b975f7270b6c117e60ee13eb6af5d2b4dfb46c1642955097d + id: a00738ed41d38f96ac3e8ff2b9e9f72efbc133b8b8df640a316d1bb0b9fa8df4 operation: - document: | { @@ -216,7 +216,7 @@ operationPlan: shortHash: eb031eaf xxHash: 4521039358647609895 resultSelectionSet: >- - { productById } + { productById { shared { schema1 } id } } - id: 2 type: Operation schema: B diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Level.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Level.yaml index 19f19c36156..0c795ccee55 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Level.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup_With_Extra_Fields_On_Shared_Level.yaml @@ -205,7 +205,7 @@ sourceSchemas: } } operationPlan: - id: 58096d0351ca7de971ca3f8b63f957acad8e39b3c17ebd92c725913015580218 + id: 7f6f310d929260420d23f959b43e79fc29377b6a1828c1fb483f5743b552356a operation: - document: | { @@ -246,7 +246,7 @@ operationPlan: shortHash: 68c353dc xxHash: 9399151880404412260 resultSelectionSet: >- - { productById } + { productById { schema1 shared { schema1 } id } } - id: 2 type: Operation schema: B diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup_With_Type_Refinement.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup_With_Type_Refinement.yaml index 243845d54bf..5ccd72a6adc 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup_With_Type_Refinement.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Shared_Parent_Field_Below_Type_With_Lookup_With_Type_Refinement.yaml @@ -184,7 +184,7 @@ sourceSchemas: } } operationPlan: - id: edc7f39669895eb9e0668c4764a82f104c08becaf5c4df4c3019e50c6c0f9e71 + id: 8e4138c125f238ab73ca9de0550f7529529e442e2459da1a6fa45ce5fa22d0c3 operation: - document: | { @@ -228,7 +228,7 @@ operationPlan: shortHash: 1cc546bb xxHash: 9616390446883977992 resultSelectionSet: >- - { unsharedInterface } + { unsharedInterface { __typename ... on Product { shared { schema1 } id } } } - id: 2 type: Operation schema: B diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_And_Products_Query_TopProducts.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_And_Products_Query_TopProducts.yaml index 15af6b7fe4c..0e0a904a7c5 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_And_Products_Query_TopProducts.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_And_Products_Query_TopProducts.yaml @@ -463,7 +463,7 @@ sourceSchemas: } } operationPlan: - id: 4620f88d1bfb9e28271a69089aa56bd1e90fff6dabe516d455eb6ecf21968c31 + id: 69809283e23928e579380ebd72d5db5e8aed3364756ed088a3ab2b0cd9193278 operation: - document: | query TopProducts { @@ -530,7 +530,7 @@ operationPlan: xxHash: 10044828563868677926 lookupTypeName: Product resultSelectionSet: >- - { reviews } + { reviews { body author { id } } } source: $.node target: $.topProducts requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_And_Products_Query_TypeName.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_And_Products_Query_TypeName.yaml index d486118d6cc..52fa89b86a7 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_And_Products_Query_TypeName.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_And_Products_Query_TypeName.yaml @@ -341,7 +341,7 @@ sourceSchemas: } } operationPlan: - id: de9906ba4248716a80d037a7fa87899a915b57298219e009543290db8cdef478 + id: a8b894b0b7e9451507d095a046a5d45c02a2ea3a6391fc7e48e7f6a6abac8a88 operation: - document: | query TopProducts { @@ -409,7 +409,7 @@ operationPlan: xxHash: 12528713562901367247 lookupTypeName: Product resultSelectionSet: >- - { reviews } + { reviews { __typename author { __typename } } } source: $.node target: $.topProducts requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Batch_Requests.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Batch_Requests.yaml index 05042168112..013169c1a40 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Batch_Requests.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Batch_Requests.yaml @@ -188,7 +188,7 @@ sourceSchemas: } } operationPlan: - id: 5d16e02e4a7f0bcdc496d65f030bb1aeba4fb878352ff1d855380a729ba99fb9 + id: 9cc8a4c11e366e4de9905a638466a4ce8894bf65d714337753b730398cb5f9d5 operation: - document: | query GetUser { @@ -227,7 +227,7 @@ operationPlan: shortHash: 734bc818 xxHash: 15739999752072096881 resultSelectionSet: >- - { reviews } + { reviews { body author { id } } } - id: 2 type: Operation schema: A diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews.yaml index 61cef0751bf..15abfb30b55 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews.yaml @@ -421,7 +421,7 @@ sourceSchemas: } } operationPlan: - id: aa1e7f87a8e35d6fb997b1cae96215dd3368e563ef6a4398e0857fb8dd15d07e + id: ec8ef24c254b79627ad12f958ff1cb461896e70957d8d585d54fa5c022aa29c8 operation: - document: | query GetUser { @@ -488,7 +488,7 @@ operationPlan: xxHash: 2210872165402831104 lookupTypeName: User resultSelectionSet: >- - { reviews } + { reviews { body author { id } } } source: $.node target: $.users requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Report_Cost.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Report_Cost.yaml index 8a4e8fbe600..e8aa7c5b04c 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Report_Cost.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Report_Cost.yaml @@ -438,7 +438,7 @@ sourceSchemas: } } operationPlan: - id: aa1e7f87a8e35d6fb997b1cae96215dd3368e563ef6a4398e0857fb8dd15d07e + id: ec8ef24c254b79627ad12f958ff1cb461896e70957d8d585d54fa5c022aa29c8 operation: - document: | query GetUser { @@ -505,7 +505,7 @@ operationPlan: xxHash: 2210872165402831104 lookupTypeName: User resultSelectionSet: >- - { reviews } + { reviews { body author { id } } } source: $.node target: $.users requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Skip_Author.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Skip_Author.yaml index 2ac393c135b..ae00afd8e44 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Skip_Author.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Skip_Author.yaml @@ -250,7 +250,7 @@ sourceSchemas: } } operationPlan: - id: bfef4a0f49621b108b718ac688118b20783d36f69299b41e3851feaeb5c8c312 + id: b8a81246ea4e2d1480f96e1ac6b4ee84cdc66d1a906ebd70d7aa7b5e84a9e22f operation: - document: | query GetUser($skip: Boolean!) { @@ -318,7 +318,7 @@ operationPlan: xxHash: 3993679361993015825 lookupTypeName: User resultSelectionSet: >- - { reviews } + { reviews { body author { id } } } source: $.node target: $.users requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Skip_Author_ErrorField.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Skip_Author_ErrorField.yaml index 2bedce4a67a..c9253659d19 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Skip_Author_ErrorField.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_GetUserReviews_Skip_Author_ErrorField.yaml @@ -450,7 +450,7 @@ sourceSchemas: } } operationPlan: - id: 0f7e81497b6676b1d6c8b2f67443e5b7c8411bfe0a40ca5415a7097ddd98821d + id: 949862d1d3d04af6eb4cf4b1a197b8c6cf9eeece6331d89eacc6b79ca5e6f353 operation: - document: | query GetUser($skip: Boolean!) { @@ -520,7 +520,7 @@ operationPlan: xxHash: 12390452335447417889 lookupTypeName: User resultSelectionSet: >- - { reviews } + { reviews { body author { errorField id } } } source: $.node target: $.users requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_ReviewsUser.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_ReviewsUser.yaml index 2357d99fa2b..6d4215bcc74 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_ReviewsUser.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Authors_And_Reviews_Query_ReviewsUser.yaml @@ -626,7 +626,7 @@ sourceSchemas: } } operationPlan: - id: ebd2cc7d18fa2d58f26d8ba62b2b782bf327aa93d1d7506bd422538e7024fb46 + id: da8cb7fc5e217156387c1e5c813ae98f03bea63750cf62d10d4cf562a19b6e25 operation: - document: | query GetUser { @@ -689,7 +689,7 @@ operationPlan: shortHash: d1b519be xxHash: 4373669865139510497 resultSelectionSet: >- - { a b } + { a { body author { id } } b { body author { id } } } - id: 2 type: Operation schema: A @@ -733,7 +733,7 @@ operationPlan: xxHash: 748009871427004425 lookupTypeName: User resultSelectionSet: >- - { reviews } + { reviews { body author { id } } } source: $.node target: $.users requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values.yaml index d116f9d004e..7272deaa38b 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values.yaml @@ -329,7 +329,7 @@ sourceSchemas: } } operationPlan: - id: 53e72e066a6d490aa7194993f7f07a148c332ce3cd50ff69abda093ad2932389 + id: c0f4d57d57105fd5019338198c8208d0b66184fd9040683baf60507dd603da2c operation: - document: | { @@ -404,7 +404,7 @@ operationPlan: xxHash: 5208033323473872181 lookupTypeName: User resultSelectionSet: >- - { feedbacks } + { feedbacks { edges { node { feedback { buyer { id } } } } } } source: $.node target: $.userBySlug requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_And_Forwarded_Variable.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_And_Forwarded_Variable.yaml index 05bf1939a4d..84255dbb316 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_And_Forwarded_Variable.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_And_Forwarded_Variable.yaml @@ -340,7 +340,7 @@ sourceSchemas: } } operationPlan: - id: e68412bd9de5c81fb9c3c5c7727920d47f5e0392121b1c212f5c9793b7f99fa8 + id: 3d2f7a35fd13d44b3e4085718d78a2d6fb8f438da256bcea5b93cfe6e3a22d42 operation: - document: | query($arg1: String, $arg2: String) { @@ -415,7 +415,7 @@ operationPlan: xxHash: 1733325756935233487 lookupTypeName: User resultSelectionSet: >- - { feedbacks } + { feedbacks { edges { node { feedback { buyer { id } } } } } } source: $.node target: $.userBySlug requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_Some_Items_Null.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_Some_Items_Null.yaml index 4b2142597a2..8747fd1062c 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_Some_Items_Null.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.BatchExecutionState_With_Multiple_Variable_Values_Some_Items_Null.yaml @@ -329,7 +329,7 @@ sourceSchemas: } } operationPlan: - id: 53e72e066a6d490aa7194993f7f07a148c332ce3cd50ff69abda093ad2932389 + id: c0f4d57d57105fd5019338198c8208d0b66184fd9040683baf60507dd603da2c operation: - document: | { @@ -404,7 +404,7 @@ operationPlan: xxHash: 5208033323473872181 lookupTypeName: User resultSelectionSet: >- - { feedbacks } + { feedbacks { edges { node { feedback { buyer { id } } } } } } source: $.node target: $.userBySlug requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node.yaml index 07b2465f9f2..93d8cd85fee 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node.yaml @@ -145,7 +145,7 @@ sourceSchemas: } } operationPlan: - id: 6d80b9e56d70265c4f554908fd3ed016fe94ebee418c4badbd2f0e9f2c56ac5c + id: a073a1bb0268ceaaf688e1015e0ea46d00649d6599e39d6b287afa6c8fd7f172 operation: - document: | query($productId: ID!) { @@ -186,7 +186,7 @@ operationPlan: shortHash: 3e337fcc xxHash: 2549249803052768011 resultSelectionSet: >- - { productById } + { productById { subgraph1Only { sharedLinked { __typename } id } } } forwardedVariables: - productId - id: 2 diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node_2.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node_2.yaml index 9bcd7956bc0..a85e7a89d74 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node_2.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node_2.yaml @@ -172,7 +172,7 @@ sourceSchemas: } } operationPlan: - id: af3548f89398f3c353a6dc9dc1fc3ac9d06c8d4ad43500d037c0e359494db43b + id: 191fbef119a0ba335d69cc1d343924ab053a078e0459fb9e5c59dba64485e315 operation: - document: | query($productId: ID!) { @@ -215,7 +215,7 @@ operationPlan: shortHash: 97fe7534 xxHash: 100778524741868765 resultSelectionSet: >- - { productById } + { productById { subgraph1Only { sharedLinked { sharedScalar } id } } } forwardedVariables: - productId - id: 2 diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node_3.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node_3.yaml index 3a66a1045d6..036a304af4e 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node_3.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Field_Below_Shared_Field_Only_Available_On_One_Subgraph_Type_Of_Shared_Field_Not_Node_3.yaml @@ -182,7 +182,7 @@ sourceSchemas: } } operationPlan: - id: a384a08758381e4461547f6f76d2e85b1d3bc587f78025b06c05b00e54910f3d + id: 75e5470e3ca2b6fdb7c800de206b503fd6e2e07b89dd2ea3fb62b2a94a8b1a0e operation: - document: | query($productId: ID!) { @@ -229,7 +229,7 @@ operationPlan: shortHash: a85e3af7 xxHash: 14752999323830711478 resultSelectionSet: >- - { productById } + { productById { subgraph1Only { subgraph1Only sharedLinked { sharedScalar subgraph1Only } id } } } forwardedVariables: - productId - id: 2 diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context.yaml index 8d61a0f2492..f95e94260bf 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context.yaml @@ -417,7 +417,7 @@ sourceSchemas: } } operationPlan: - id: 463bf34ac47ca829004fbdc50d562ef961b34be00538102e4e73c994c6d8bb71 + id: cd8023fdfb12c9e0fd0489da8b17df171d4151f6dfcb3e9f1321858a5af0ee4c operation: - document: | query Requires { @@ -468,7 +468,7 @@ operationPlan: shortHash: 714e8d42 xxHash: 15525273958196042721 resultSelectionSet: >- - { reviews } + { reviews { body author { id } product } } - id: 2 type: Operation schema: D diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context_2.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context_2.yaml index cf504b3c597..20e7de2fca4 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context_2.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context_2.yaml @@ -365,7 +365,7 @@ sourceSchemas: } } operationPlan: - id: 86bb218c3b3c627bacd7c089aade96c065c03e896799d044dadd2a6e119ef7cf + id: ad83e5cc19c45ff3b6905a07bcf0a3d6d2ab830a917bbd79bef85422d372e664 operation: - document: | query Requires { @@ -415,7 +415,7 @@ operationPlan: shortHash: 0a01995e xxHash: 6355109712671792565 resultSelectionSet: >- - { reviews } + { reviews { body author { id } product } } - id: 2 type: Operation schema: D diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context_3.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context_3.yaml index 6e6cae7b82f..d5aec5f78a7 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context_3.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Require_Data_In_Context_3.yaml @@ -880,7 +880,7 @@ sourceSchemas: } } operationPlan: - id: abee1c25fad0dae7d629e3ebf755b3f316e8d2b4ff3a95af549f6c65a7fa9919 + id: c1b153da5352e90e713076f00a4fbcf84760f369d33b8689d19afba45ab199a4 operation: - document: | query Large { @@ -962,7 +962,7 @@ operationPlan: xxHash: 230339351698870140 lookupTypeName: User resultSelectionSet: >- - { reviews } + { reviews { body author { id } product } } source: $.node target: $.users requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Same_Selection_On_Two_Object_Types_That_Require_Data_From_Another_Subgraph.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Same_Selection_On_Two_Object_Types_That_Require_Data_From_Another_Subgraph.yaml index 9db9949b53f..1075cfc4e21 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Same_Selection_On_Two_Object_Types_That_Require_Data_From_Another_Subgraph.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Same_Selection_On_Two_Object_Types_That_Require_Data_From_Another_Subgraph.yaml @@ -155,7 +155,7 @@ sourceSchemas: } } operationPlan: - id: c9159c3638a351e1459c705dad3c51253205d04de82cb5c3aaafbe40bdcdd4ae + id: b19145d83d4c6bed1020ef87c98429c8507496697daee150810df9cab440c402 operation: - document: | { @@ -204,7 +204,7 @@ operationPlan: shortHash: 9be075a6 xxHash: 8287171871325115487 resultSelectionSet: >- - { item1 item2 } + { item1 { product { id } } item2 { product { id } } } - id: 2 type: OperationBatch schema: B diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Unresolvable_Subgraph_Is_Not_Chosen_If_Data_Is_Available_In_Resolvable_Subgraph.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Unresolvable_Subgraph_Is_Not_Chosen_If_Data_Is_Available_In_Resolvable_Subgraph.yaml index 86f672d7d20..c5f0dba1774 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Unresolvable_Subgraph_Is_Not_Chosen_If_Data_Is_Available_In_Resolvable_Subgraph.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/v15/__snapshots__/DemoIntegrationTests.Unresolvable_Subgraph_Is_Not_Chosen_If_Data_Is_Available_In_Resolvable_Subgraph.yaml @@ -130,7 +130,7 @@ sourceSchemas: } } operationPlan: - id: 74cabb739073fd16efdfac43f0b44de3d5b25423222d9a8a4464e13c04e059ea + id: ef2362bba07ce2fb31fb64d3ac4c06e036d9cb5b4f0f6fce749cd6f33ad96d15 operation: - document: | { @@ -167,7 +167,7 @@ operationPlan: shortHash: 485903a8 xxHash: 13938309490224902434 resultSelectionSet: >- - { viewer } + { viewer { product { id } } } - id: 2 type: Operation schema: C diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/RequirementArrivalPathPlanningTests.cs b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/RequirementArrivalPathPlanningTests.cs index c747154aac2..c69828f1004 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/RequirementArrivalPathPlanningTests.cs +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/RequirementArrivalPathPlanningTests.cs @@ -825,7 +825,7 @@ type T2 { MatchInline( plan, """ - id: 980c8a177d620c7c84c3667ec01899270eb6e4345ecd45e7bda2351360632ca9 + id: fe57adedbeb216c2a2fb892f9c2ed62acf7ccdb36ffebee19f5106fd18c14364 operation: - document: | mutation { @@ -869,7 +869,7 @@ mutation Op_123456789101112_1 { shortHash: cac8c653 xxHash: 6209407811876964816 resultSelectionSet: >- - { doB } + { doB { viewer { vt { f2 { id } } } } } - id: 2 type: Operation schema: D @@ -1015,7 +1015,7 @@ type N { MatchInline( plan, """ - id: ccf6583e9b24d4c9c61169edf1e54bdc45042ba7c8d72d8b159c2ffb5b093633 + id: 24ee721fb319ccc9004716a85831304a57b346d01f69e4c2d0a947c1f1b5721b operation: - document: | { @@ -1122,7 +1122,7 @@ query Op_123456789101112_1 { shortHash: 160741bb xxHash: 5870523207090737025 resultSelectionSet: >- - { x } + { x { t { __typename n } id } } batchingGroupId: 5 - id: 4 type: Operation @@ -1144,7 +1144,7 @@ query Op_123456789101112_4 { shortHash: 15d76e16 xxHash: 7336655642061676120 resultSelectionSet: >- - { x } + { x { t { n } } } batchingGroupId: 5 """); } diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/RequirementTests.cs b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/RequirementTests.cs index 6fb5b98791e..128d83ae4e7 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/RequirementTests.cs +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/RequirementTests.cs @@ -558,7 +558,7 @@ type Details { MatchInline( plan, """ - id: 7a3637e68089675cf344ea98566b6f93383e0e4c9ab7127b5cd1f56a3ad8e516 + id: 64351b59cc89eefc50ef51f60b3ce646940b945b308bea293f9a2533e891e425 operation: - document: | { @@ -596,7 +596,7 @@ query Op_123456789101112_1 { shortHash: a8add3c3 xxHash: 9816577427737023502 resultSelectionSet: >- - { products } + { products { details { __typename weight } id } } - id: 2 type: Operation schema: b diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/AbstractLookupFanoutPlanningTests.Plan_Should_Prune_Impossible_Concrete_Fragment_When_Parent_Is_Object.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/AbstractLookupFanoutPlanningTests.Plan_Should_Prune_Impossible_Concrete_Fragment_When_Parent_Is_Object.yaml index f3b3dc1358b..164fdff956f 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/AbstractLookupFanoutPlanningTests.Plan_Should_Prune_Impossible_Concrete_Fragment_When_Parent_Is_Object.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/AbstractLookupFanoutPlanningTests.Plan_Should_Prune_Impossible_Concrete_Fragment_When_Parent_Is_Object.yaml @@ -1,4 +1,4 @@ -id: b8f3adad9db1a1de44ca1df6bd03dec242888311366aeaafa5ce971d67574316 +id: ac633c84788419a16241749c4803c385e8818e15ef37d05a3bdcac071cc2a622 operation: - document: | { @@ -70,7 +70,7 @@ nodes: xxHash: 11232871436440941999 lookupTypeName: Magazine resultSelectionSet: >- - { reviews } + { reviews { product { __typename reviewsCount id } } } source: $.magazineById target: $.products batchingGroupId: 10 @@ -105,7 +105,7 @@ nodes: xxHash: 10083997751294899173 lookupTypeName: Book resultSelectionSet: >- - { reviews } + { reviews { product { __typename reviewsCount id } } } source: $.bookById target: $.products batchingGroupId: 10 diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/EntityChainTests.Complex_Entity_Call.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/EntityChainTests.Complex_Entity_Call.yaml index c1e0504ea3b..52d9b5067e5 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/EntityChainTests.Complex_Entity_Call.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/EntityChainTests.Complex_Entity_Call.yaml @@ -1,4 +1,4 @@ -id: c4e6e22d7d3cfb9c3b9fbf009e14e7a21e3dcc7a97eacb6d0d46a209be8cdf29 +id: 12f6f19f0ab7117d5623d3af5ebc215cb39c5971c8da425493623ec801091eb2 operation: - document: | { @@ -46,7 +46,7 @@ nodes: shortHash: 50ee499a xxHash: 10122488351664823367 resultSelectionSet: >- - { topProducts } + { topProducts { products { id category { id tag } } } } - id: 2 type: Operation schema: price diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/FusionBenchmarkTests.Complex_Query.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/FusionBenchmarkTests.Complex_Query.yaml index ff38b45d046..355286c8901 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/FusionBenchmarkTests.Complex_Query.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/FusionBenchmarkTests.Complex_Query.yaml @@ -1,4 +1,4 @@ -id: acb7c186fded29e84ca61b0214b01b1079f015ae0d5920ff2182d85ad5695902 +id: d9791df4db4c91956b0d72870997fb32fd44d6bc6ca439ab41f37448bfd71628 operation: - document: | query( @@ -274,7 +274,7 @@ nodes: shortHash: 70aadd24 xxHash: 18208276380645330079 resultSelectionSet: >- - { viewer { reviews } } + { viewer { reviews { pageInfo { hasNextPage hasPreviousPage startCursor endCursor } edges } } } forwardedVariables: - includeReviews - id: 2 @@ -615,7 +615,7 @@ nodes: xxHash: 3574020953864281737 lookupTypeName: Product resultSelectionSet: >- - { reviews } + { reviews { pageInfo { hasNextPage ... { hasPreviousPage startCursor endCursor } } edges } } source: $.productById target: $.productById batchingGroupId: 31 diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/FusionBenchmarkTests.Conditional_Redundancy_Query.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/FusionBenchmarkTests.Conditional_Redundancy_Query.yaml index db061d27773..630feb5197b 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/FusionBenchmarkTests.Conditional_Redundancy_Query.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/FusionBenchmarkTests.Conditional_Redundancy_Query.yaml @@ -1,4 +1,4 @@ -id: 2726bacc966f6fba5c5c02dadd35bcf66413e74163b5527d9efd0b0078fc0a1a +id: 688af56d10dfbdb4ea1073692585dd80f39bb544b6b65603d05129bc87b8dab1 operation: - document: | query( @@ -184,7 +184,7 @@ nodes: shortHash: acd831c5 xxHash: 1957394699082372954 resultSelectionSet: >- - { viewer { reviews } } + { viewer { reviews { pageInfo { hasNextPage hasPreviousPage ... { startCursor endCursor } } edges } } } forwardedVariables: - includeReviews - includeMetadata @@ -570,7 +570,7 @@ nodes: xxHash: 13457195167788864967 lookupTypeName: Product resultSelectionSet: >- - { averageRating reviews } + { averageRating reviews { pageInfo { hasNextPage hasPreviousPage ... { startCursor endCursor } } edges } } source: $.productById target: $.productById batchingGroupId: 14 diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/InterfaceLookupPlanningTests.Abstract_Customer_Interface_With_Email_Is_Plannable.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/InterfaceLookupPlanningTests.Abstract_Customer_Interface_With_Email_Is_Plannable.yaml index 3ef6f7764ce..a2bae549cbd 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/InterfaceLookupPlanningTests.Abstract_Customer_Interface_With_Email_Is_Plannable.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/InterfaceLookupPlanningTests.Abstract_Customer_Interface_With_Email_Is_Plannable.yaml @@ -1,4 +1,4 @@ -id: f6abf268b3a5d464f40a8a05ecafce0ed30ea4dc1af1989c626fc91158b0e2b5 +id: 19cb04bc4e0cdca240a587ffccf6ef0cf1f489ee543628349c7360268ae7c03e operation: - document: | { @@ -47,7 +47,7 @@ nodes: shortHash: c7845a61 xxHash: 5946333898351363375 resultSelectionSet: >- - { ordersByAgent } + { ordersByAgent { edges { node { id customer { __typename id } } } } } - id: 2 type: Operation schema: de diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/PlannerAdvancedAdaptationTests.Provides_Nested_Provides.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/PlannerAdvancedAdaptationTests.Provides_Nested_Provides.yaml index d56724ae89f..d8c9565ef75 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/PlannerAdvancedAdaptationTests.Provides_Nested_Provides.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/PlannerAdvancedAdaptationTests.Provides_Nested_Provides.yaml @@ -1,4 +1,4 @@ -id: d62d67049619468d2051e765a7284e7b9812c3cb864205d0998c9a38a57ba051 +id: 4a7a90e76d5ec48371db186ee89e1bb821a730856e1c81a1bee74a5dfb21fcc6 operation: - document: | { @@ -45,4 +45,4 @@ nodes: shortHash: e71de26b xxHash: 12731655434071372543 resultSelectionSet: >- - { products } + { products { id categories { id name details { id name } } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/ProvidesPlannerTests.PlanOperation_Should_ReenterEntityForProvidedField_When_FieldBelowIsExternalInReenteredSchema.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/ProvidesPlannerTests.PlanOperation_Should_ReenterEntityForProvidedField_When_FieldBelowIsExternalInReenteredSchema.yaml index 188d439045d..3be5e2beb78 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/ProvidesPlannerTests.PlanOperation_Should_ReenterEntityForProvidedField_When_FieldBelowIsExternalInReenteredSchema.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/ProvidesPlannerTests.PlanOperation_Should_ReenterEntityForProvidedField_When_FieldBelowIsExternalInReenteredSchema.yaml @@ -1,4 +1,4 @@ -id: a7d30825c7c5476ea9498ba218895c14903a312ace5ead8efa94a7b3a471fb11 +id: abb266f121d4f8399906a6a87adb71af36f6b353aa910f59fcf3b5ba0f6b4553 operation: - document: | { @@ -40,7 +40,7 @@ nodes: shortHash: 8d67b6f2 xxHash: 10970322977830876723 resultSelectionSet: >- - { orders } + { orders { item { customer { email } } id } } - id: 2 type: Operation schema: a diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/ProvidesPlannerTests.Provides_On_Interface.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/ProvidesPlannerTests.Provides_On_Interface.yaml index 9db4b4fa61f..cb35f462c95 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/ProvidesPlannerTests.Provides_On_Interface.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/ProvidesPlannerTests.Provides_On_Interface.yaml @@ -1,4 +1,4 @@ -id: d9b178c09f9b75b5447a916920f443d886f85aa68e1fd905d61ed07603cc2d4c +id: cca0a5087fc31c40bab89adeef7a27fc9885fc980cbde082a7d0314c4d875cf7 operation: - document: | { @@ -45,4 +45,4 @@ nodes: shortHash: 494adae6 xxHash: 2446306219634372817 resultSelectionSet: >- - { book } + { book { featured { __typename ... on Cat { age } ... on Dog { tricks } } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchLookupKeyByReTraversingPath_When_PathExistsInKeySchema.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchLookupKeyByReTraversingPath_When_PathExistsInKeySchema.yaml index 31f38f4155b..f414b6ba4c2 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchLookupKeyByReTraversingPath_When_PathExistsInKeySchema.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchLookupKeyByReTraversingPath_When_PathExistsInKeySchema.yaml @@ -1,4 +1,4 @@ -id: 7f2b6277bf4a70805f62e5f518f699827301b1b0d852aa7732997c77d8775fcc +id: 2f8b3037616d7c2d5739859841dd61ef7c8f8df9a9c10302ff416f8d21e33152 operation: - document: | { @@ -88,7 +88,7 @@ nodes: shortHash: "09782999" xxHash: 11927572499165394578 resultSelectionSet: >- - { good { p } } + { good { p { t { f } } } } requirements: - name: __fusion_2_q type: String diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchNestedRequirement_When_RequirementDataDependsOnEarlierCallOfRequiringSchema.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchNestedRequirement_When_RequirementDataDependsOnEarlierCallOfRequiringSchema.yaml index 51284c97b15..81b7b0fbad2 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchNestedRequirement_When_RequirementDataDependsOnEarlierCallOfRequiringSchema.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchNestedRequirement_When_RequirementDataDependsOnEarlierCallOfRequiringSchema.yaml @@ -1,4 +1,4 @@ -id: 1d5a185d1b650a4c4b4247cab0503ce6a3249cf6bee9911d670ffbe6b425adb8 +id: 911fdf10b1aaa0e844975ca365d36b3866c08461bf3e1ec490b03899cb197730 operation: - document: | { @@ -132,7 +132,7 @@ nodes: xxHash: 15767508457989934295 lookupTypeName: H1 resultSelectionSet: >- - { b } + { b { l { __typename m } id } } source: $.h1ById target: $.root.a batchingGroupId: 6 @@ -167,7 +167,7 @@ nodes: xxHash: 599250030796056423 lookupTypeName: H1 resultSelectionSet: >- - { b } + { b { l { m } } } source: $.h1ById target: $.root.a batchingGroupId: 6 diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_RequirementDataDependsOnEarlierCallOfRequiringSchema.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_RequirementDataDependsOnEarlierCallOfRequiringSchema.yaml index 1947ec86223..749d8a099e5 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_RequirementDataDependsOnEarlierCallOfRequiringSchema.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_RequirementDataDependsOnEarlierCallOfRequiringSchema.yaml @@ -1,4 +1,4 @@ -id: 1eb609b5c43d360f1784d830ef2077ea6f31387ccf0504cb613c2040267ef942 +id: 5bdf8ddbd999bebf7587f906f4401e5920b5330e93fbfa47a29e4e745e8c5fa0 operation: - document: | { @@ -63,7 +63,7 @@ nodes: xxHash: 8145051031305642926 lookupTypeName: H1 resultSelectionSet: >- - { b } + { b { l { __typename x } id } } source: $.h1ById target: $.root.a requirements: diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_ViewerIsReRootedOrParentHasLookup_mutation_doOther.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_ViewerIsReRootedOrParentHasLookup_mutation_doOther.yaml index 09de887d907..82f873b1516 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_ViewerIsReRootedOrParentHasLookup_mutation_doOther.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_ViewerIsReRootedOrParentHasLookup_mutation_doOther.yaml @@ -1,4 +1,4 @@ -id: b2f2bbabc0b1d26684c392c411b5b363d31b7e3ad61792597a0aaa17e0766724 +id: 9939282217c00893cb0cfd48c31479c24e749e9528260e06531ee463f83cb5ab operation: - document: | mutation { @@ -41,7 +41,7 @@ nodes: shortHash: 6dc35db2 xxHash: 9561269719161907611 resultSelectionSet: >- - { doOther } + { doOther { me { t } id } } - id: 2 type: Operation schema: a diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_ViewerIsReRootedOrParentHasLookup_subscription_doOther.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_ViewerIsReRootedOrParentHasLookup_subscription_doOther.yaml index 7a0fb456459..457de4e5805 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_ViewerIsReRootedOrParentHasLookup_subscription_doOther.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementArrivalPathPlanningTests.Plan_Should_FetchRequirement_When_ViewerIsReRootedOrParentHasLookup_subscription_doOther.yaml @@ -1,4 +1,4 @@ -id: 5638d257f9e280db5061d3c9d18f4c5003ef69eed5bc6f0c6f0c075db4449ff8 +id: f3d7fc43e318287ca7e9dd93518dfc06d127ee32c0b7169012218548700be556 operation: - document: | subscription { @@ -41,7 +41,7 @@ nodes: shortHash: f92b2f4c xxHash: 1819270763937879956 resultSelectionSet: >- - { doOther } + { doOther { me { t } id } } - id: 2 type: Operation schema: a diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementCrossEntityTests.Plan_Should_Reenter_Requiring_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementCrossEntityTests.Plan_Should_Reenter_Requiring_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml index bed7bfc9aac..ed0a797b56b 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementCrossEntityTests.Plan_Should_Reenter_Requiring_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementCrossEntityTests.Plan_Should_Reenter_Requiring_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml @@ -1,4 +1,4 @@ -id: b4a0f701e82540076e230671711e0f4e578c4ae0fb31af29bc429e912b6d3e7a +id: a2413401cc34975c5da35d2ce7b17b793f2ee5ce2f8b393ae6e411a83fdea244 operation: - document: | { @@ -101,7 +101,7 @@ nodes: shortHash: c0eb1b6a xxHash: 353369140000315026 resultSelectionSet: >- - { orders } + { orders { id customer { __typename } } } batchingGroupId: 5 - id: 4 type: Operation @@ -124,5 +124,5 @@ nodes: shortHash: 8485f3d7 xxHash: 15051843334004293780 resultSelectionSet: >- - { orders } + { orders { customer { __typename ... on Customer { id } } } } batchingGroupId: 5 diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementCrossEntityTests.Plan_Should_Resolve_Nested_Required_Field_From_Third_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementCrossEntityTests.Plan_Should_Resolve_Nested_Required_Field_From_Third_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml index 122a5a2ad31..0ef3aba8be7 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementCrossEntityTests.Plan_Should_Resolve_Nested_Required_Field_From_Third_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementCrossEntityTests.Plan_Should_Resolve_Nested_Required_Field_From_Third_Schema_When_Abstract_First_Level_Has_No_Type_Condition.yaml @@ -1,4 +1,4 @@ -id: 0df7ccc63c327e2bfbafcba410e937dc7eb4b7180d49fe6a5842da3a0325692c +id: bdb9e11d1868f01b1a43546a8f2ab230a3c2856d4e4d2de75a9bfee3144c314d operation: - document: | { @@ -101,7 +101,7 @@ nodes: shortHash: c0eb1b6a xxHash: 353369140000315026 resultSelectionSet: >- - { orders } + { orders { id customer { __typename } } } batchingGroupId: 5 - id: 4 type: Operation @@ -124,5 +124,5 @@ nodes: shortHash: 8485f3d7 xxHash: 15051843334004293780 resultSelectionSet: >- - { orders } + { orders { customer { __typename ... on Customer { id } } } } batchingGroupId: 5 diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementParityTests.Requires_With_Fragments_On_Interfaces.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementParityTests.Requires_With_Fragments_On_Interfaces.yaml index 7e11119d71b..cb8d4acc17e 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementParityTests.Requires_With_Fragments_On_Interfaces.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/RequirementParityTests.Requires_With_Fragments_On_Interfaces.yaml @@ -1,4 +1,4 @@ -id: cd9ef93667243c1166179dc9307d4b6eed2bf91a5d107682b2721a8160b41028 +id: 970676fbf6575bae5d958bf9f5978105d273001a5e7e967eb12ceb673b411dd8 operation: - document: | { @@ -58,7 +58,7 @@ nodes: shortHash: 53b51ba5 xxHash: 15657460751648869004 resultSelectionSet: >- - { userFromA } + { userFromA { id profile { __typename displayName ... on AdminAccount { accountType } ... on GuestAccount { accountType } ... on AdminAccount { adminLevel } ... on GuestAccount { guestToken } } } } - id: 2 type: Operation schema: b From 08d5f529b4e7d9b6bd9378403790636bf02aa19a Mon Sep 17 00:00:00 2001 From: tobias-tengler <45513122+tobias-tengler@users.noreply.github.com> Date: Wed, 18 Nov 2026 09:54:56 +0000 Subject: [PATCH 2/2] [Fusion] Fix missing shared union selections in operation plans --- .../Extensions/TypeDefinitionExtensions.cs | 4 + .../Execution/Nodes/Selection.cs | 4 +- .../Execution/Results/ValueCompletion.cs | 20 +-- .../OperationPlanner.BuildExecutionTree.cs | 6 +- .../Planning/OperationPlanner.cs | 2 +- .../SharedPathErrorPocketingTests.cs | 41 +++++ ...ortError_When_NestedSharedUnionIsNull.yaml | 142 ++++++++++++++++++ ...Union_Root_Field_With_Type_Refinement.yaml | 6 +- ...daptationTests.Union_Union_Member_Mix.yaml | 4 +- 9 files changed, 198 insertions(+), 31 deletions(-) create mode 100644 src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.ValueCompletion_Should_ReportError_When_NestedSharedUnionIsNull.yaml diff --git a/src/HotChocolate/Fusion/src/Fusion.Execution.Types/Extensions/TypeDefinitionExtensions.cs b/src/HotChocolate/Fusion/src/Fusion.Execution.Types/Extensions/TypeDefinitionExtensions.cs index 4b35842f927..4bbf41e880b 100644 --- a/src/HotChocolate/Fusion/src/Fusion.Execution.Types/Extensions/TypeDefinitionExtensions.cs +++ b/src/HotChocolate/Fusion/src/Fusion.Execution.Types/Extensions/TypeDefinitionExtensions.cs @@ -4,6 +4,10 @@ namespace HotChocolate.Fusion.Types; internal static class TypeDefinitionExtensions { + public static bool IsSharedValueType(this ITypeDefinition type) + => type is FusionComplexTypeDefinition { IsValueType: true } + or FusionUnionTypeDefinition { IsValueType: true }; + public static bool ExistsInSchema(this ITypeDefinition type, string schemaName) { return type switch diff --git a/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Selection.cs b/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Selection.cs index 707e03ae8b8..d578a11c4e7 100644 --- a/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Selection.cs +++ b/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Nodes/Selection.cs @@ -122,9 +122,7 @@ internal Selection( _flags |= Flags.EnumValue; } - if (namedType is FusionObjectTypeDefinition { IsValueType: true } - or FusionInterfaceTypeDefinition { IsValueType: true } - or FusionUnionTypeDefinition { IsValueType: true }) + if (namedType.IsSharedValueType()) { _flags |= Flags.ValueTypeNamedType; } diff --git a/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs b/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs index 93a6ca8aa6b..333437977e2 100644 --- a/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs +++ b/src/HotChocolate/Fusion/src/Fusion.Execution/Execution/Results/ValueCompletion.cs @@ -636,7 +636,7 @@ private bool BuildResultForInvalidSource( { var sourceValueKind = source.ValueKind; - if (sourceValueKind is JsonValueKind.Null && IsValueType(target.Type)) + if (sourceValueKind is JsonValueKind.Null && target.Type?.NamedType().IsSharedValueType() == true) { if (error is not null) { @@ -892,24 +892,6 @@ private void PocketErrors(Path path, ResultSelectionSet resultSelectionSet, IErr } } - private static bool IsValueType(IType? type) - { - if (type is null) - { - return false; - } - - var namedType = type.NamedType(); - - return namedType switch - { - FusionObjectTypeDefinition { IsValueType: true } => true, - FusionInterfaceTypeDefinition { IsValueType: true } => true, - FusionUnionTypeDefinition { IsValueType: true } => true, - _ => false - }; - } - // TODO: When extracting an error from a path below the current field, // we should try to use the path of the original error if it's // part of what was selected. diff --git a/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs b/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs index 7baf1f534b5..d5c35f5f747 100644 --- a/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs +++ b/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.BuildExecutionTree.cs @@ -3190,11 +3190,11 @@ private static SelectionSetNode PruneNonValueTypeChildren( { var fieldNamedType = fieldDef.Type.NamedType(); - if (fieldNamedType is FusionComplexTypeDefinition { IsValueType: true } valueType) + if (fieldNamedType.IsSharedValueType()) { var pruned = PruneNonValueTypeChildren( field.SelectionSet, - valueType, + fieldNamedType, schema, sourceSchemaName, sourceAliases, @@ -3440,7 +3440,7 @@ private static bool SubtreeContainsValueType( { var fieldNamedType = fieldDef.Type.NamedType(); - if (fieldNamedType is FusionComplexTypeDefinition { IsValueType: true } + if (fieldNamedType.IsSharedValueType() || SubtreeContainsValueType(field.SelectionSet, fieldNamedType, schema)) { return true; diff --git a/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs b/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs index d825389e2bc..be401dbbd2f 100644 --- a/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs +++ b/src/HotChocolate/Fusion/src/Fusion.Execution/Planning/OperationPlanner.cs @@ -69,7 +69,7 @@ public OperationPlanner( } } - public static Version Version { get; } = new(2, 11, 0); + public static Version Version { get; } = new(2, 12, 0); private static FrozenSet CollectProtectedFieldNames(FusionSchemaDefinition schema) { diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/SharedPathErrorPocketingTests.cs b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/SharedPathErrorPocketingTests.cs index ae4a78e406e..e79d8defd6f 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/SharedPathErrorPocketingTests.cs +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/SharedPathErrorPocketingTests.cs @@ -813,4 +813,45 @@ ... on ItemPage { await MatchSnapshotAsync(gateway, request, result); } + + [Fact] + public async Task ValueCompletion_Should_ReportError_When_NestedSharedUnionIsNull() + { + // arrange + using var sourceA = CreateSourceSchema("A", + """ + type Query { page: Page } + type Page { item: Item @error } + union Item = Book + type Book { name: String } + """); + using var sourceB = CreateSourceSchema("B", + """ + type Query { other: Item } + union Item = Photo + type Photo { id: ID } + """); + using var gateway = await CreateCompositeSchemaAsync([("A", sourceA), ("B", sourceB)]); + using var client = GraphQLHttpClient.Create(gateway.CreateClient()); + var request = new OperationRequest( + """ + { + page { + item { + __typename + ... on Book { name } + } + } + } + """); + + // act + using var response = await client.PostAsync( + request, + new Uri("http://localhost:5000/graphql"), + TestContext.Current.CancellationToken); + + // assert + await MatchSnapshotAsync(gateway, request, response); + } } diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.ValueCompletion_Should_ReportError_When_NestedSharedUnionIsNull.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.ValueCompletion_Should_ReportError_When_NestedSharedUnionIsNull.yaml new file mode 100644 index 00000000000..54cdb0b6f37 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathErrorPocketingTests.ValueCompletion_Should_ReportError_When_NestedSharedUnionIsNull.yaml @@ -0,0 +1,142 @@ +title: ValueCompletion_Should_ReportError_When_NestedSharedUnionIsNull +request: + document: | + { + page { + item { + __typename + ... on Book { + name + } + } + } + } +response: + body: | + { + "data": { + "page": { + "item": null + } + }, + "errors": [ + { + "message": "Unexpected Execution Error", + "path": [ + "page", + "item" + ] + } + ] + } +sourceSchemas: + - name: A + schema: | + schema { + query: Query + } + + type Query { + page: Page + } + + type Book { + name: String + } + + type Page { + item: Item @error + } + + union Item = Book + interactions: + - request: + accept: application/graphql-response+json; charset=utf-8, application/json; charset=utf-8, application/jsonl; charset=utf-8, text/event-stream; charset=utf-8 + document: | + query Op_2040db40_1 { + page { + item { + __typename + ... on Book { + name + } + } + } + } + response: + results: + - | + { + "errors": [ + { + "message": "Unexpected Execution Error", + "path": [ + "page", + "item" + ] + } + ], + "data": { + "page": { + "item": null + } + } + } + - name: B + schema: | + schema { + query: Query + } + + type Query { + other: Item + } + + type Photo { + id: ID + } + + union Item = Photo +operationPlan: + id: f5d8b11cc58e7db43828ba6ba9b914359f83ea1c584aa660723c1998d9fd5427 + operation: + - document: | + { + page { + item { + __typename + ... on Book { + name + } + } + } + } + kind: Query + id: af2be4025cec14c8a70279f0bc7c9baf + hash: 2040db400afa2a43768e68910e5fc538 + shortHash: 2040db40 + searchSpace: 1 + expandedNodes: 1 + nodes: + - id: 1 + type: Operation + schema: A + operation: + name: Op_2040db40_1 + kind: Query + document: | + query Op_2040db40_1 { + page { + item { + __typename + ... on Book { + name + } + } + } + } + hash: d7ae95779d95c1d3e7d1ab412591cd929b7b9deb6fdd025c286b0ef7f19cfcd8 + shortHash: d7ae9577 + xxHash: 3173724587274459686 + resultSelectionSet: >- + { page { item { __typename ... on Book { name } } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Single_Shared_Union_Root_Field_With_Type_Refinement.yaml b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Single_Shared_Union_Root_Field_With_Type_Refinement.yaml index 2ca39b41762..3a6ef7cf41a 100644 --- a/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Single_Shared_Union_Root_Field_With_Type_Refinement.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.AspNetCore.Tests/__snapshots__/SharedPathTests.Single_Shared_Union_Root_Field_With_Type_Refinement.yaml @@ -170,7 +170,7 @@ sourceSchemas: } } operationPlan: - id: 6b9c6e53e29594c4ba5c91f26efbc7de9a61d3d0480c082e159fc6973aff0acd + id: bf0a8e56a4ae13047d62635e5e72f47318e3c8170af7785a4b1f172e488a41b1 operation: - document: | { @@ -208,7 +208,7 @@ operationPlan: shortHash: b42342f3 xxHash: 16245721259211064914 resultSelectionSet: >- - { union } + { union { __typename ... on Review { schema1 } } } - id: 2 type: Operation schema: B @@ -228,4 +228,4 @@ operationPlan: shortHash: 550d7ced xxHash: 14152550562616937002 resultSelectionSet: >- - { union } + { union { __typename ... on Review { schema2 } } } diff --git a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/PlannerAdvancedAdaptationTests.Union_Union_Member_Mix.yaml b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/PlannerAdvancedAdaptationTests.Union_Union_Member_Mix.yaml index 9993abe3b93..8d65807e372 100644 --- a/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/PlannerAdvancedAdaptationTests.Union_Union_Member_Mix.yaml +++ b/src/HotChocolate/Fusion/test/Fusion.Execution.Tests/Planning/__snapshots__/PlannerAdvancedAdaptationTests.Union_Union_Member_Mix.yaml @@ -1,4 +1,4 @@ -id: 0d3dabf020ac086634bd208f4e76f90660e9456df3e336c034dbb2676b3ab090 +id: f089831d143b1092d89cfae479eaa00e38d9d4c5701b58b9af1eddff2b552061 operation: - document: | { @@ -35,4 +35,4 @@ nodes: shortHash: fc6d878d xxHash: 8338259708514109094 resultSelectionSet: >- - { media } + { media { __typename ... on Book { title } } }