From 2ee3ad45fed4e390e6a515b93f3b78627a8a6bd6 Mon Sep 17 00:00:00 2001 From: Tobias Tengler <45513122+tobias-tengler@users.noreply.github.com> Date: Thu, 14 Dec 2023 08:33:11 +0100 Subject: [PATCH] Do not send omitted arguments with default values to subgraph (#6767) --- ...ResolverDefinition.FetchRewriterContext.cs | 9 +- .../ResolverDefinition.ResolverRewriter.cs | 16 +- .../src/Core/Metadata/ResolverDefinition.cs | 5 +- .../NodeRequestDocumentFormatter.cs | 7 +- .../RequestDocumentFormatter.cs | 52 ++++- .../test/Core.Tests/RequestPlannerTests.cs | 221 ++++++++++++++++++ ...ionTests.GetFirstPage_With_After_Null.snap | 4 +- .../InterfaceTests.Query_Interface_List.snap | 4 +- ...ts.Query_Interface_List_With_Fragment.snap | 4 +- ...ry_Interface_List_With_Fragment_Fetch.snap | 4 +- ...PlannerTests.Query_Plan_22_Interfaces.snap | 2 +- ...rTests.Query_Plan_23_Interfaces_Merge.snap | 2 +- ...No_Value_Specified_With_Selection_Set.snap | 33 +++ ...y_Plan_32_Argument_No_Value_Specified.snap | 31 +++ ...nt_Default_Value_Explicitly_Specified.snap | 31 +++ ..._Argument_Not_Default_Value_Specified.snap | 31 +++ ..._35_Argument_Value_Variable_Specified.snap | 36 +++ 17 files changed, 463 insertions(+), 29 deletions(-) create mode 100644 src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_31_Argument_No_Value_Specified_With_Selection_Set.snap create mode 100644 src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_32_Argument_No_Value_Specified.snap create mode 100644 src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_33_Argument_Default_Value_Explicitly_Specified.snap create mode 100644 src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_34_Argument_Not_Default_Value_Specified.snap create mode 100644 src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_35_Argument_Value_Variable_Specified.snap diff --git a/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.FetchRewriterContext.cs b/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.FetchRewriterContext.cs index 4ef523b791b..7b221eeaaf2 100644 --- a/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.FetchRewriterContext.cs +++ b/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.FetchRewriterContext.cs @@ -11,12 +11,14 @@ public FetchRewriterContext( FragmentSpreadNode? placeholder, IReadOnlyDictionary variables, SelectionSetNode? selectionSet, - string? responseName) + string? responseName, + IReadOnlyList? unspecifiedArguments) { Placeholder = placeholder; Variables = variables; SelectionSet = selectionSet; ResponseName = responseName; + UnspecifiedArguments = unspecifiedArguments; } public string? ResponseName { get; } @@ -29,6 +31,11 @@ public FetchRewriterContext( public IReadOnlyDictionary Variables { get; } + /// + /// An optional list of arguments that weren't explicitly specified in the original query. + /// + public IReadOnlyList? UnspecifiedArguments { get; } + public SelectionSetNode? SelectionSet { get; } public IReadOnlyList SelectionPath { get; set; } = Array.Empty(); diff --git a/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.ResolverRewriter.cs b/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.ResolverRewriter.cs index e9e03f907e5..ccb4f8e5373 100644 --- a/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.ResolverRewriter.cs +++ b/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.ResolverRewriter.cs @@ -12,7 +12,21 @@ private class ResolverRewriter : SyntaxRewriter { var result = base.RewriteField(node, context); - if (result is not null && context.PlaceholderFound) + if (result is null) + { + return null; + } + + if (context.UnspecifiedArguments?.Count > 0) + { + var explicitlyDefinedArguments = result.Arguments + .ExceptBy(context.UnspecifiedArguments, a => a.Name.Value) + .ToList(); + + result = result.WithArguments(explicitlyDefinedArguments); + } + + if (context.PlaceholderFound) { context.PlaceholderFound = false; diff --git a/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.cs b/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.cs index f62610a42c1..c187ceabffb 100644 --- a/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.cs +++ b/src/HotChocolate/Fusion/src/Core/Metadata/ResolverDefinition.cs @@ -53,9 +53,10 @@ public ResolverDefinition( public (ISelectionNode selectionNode, IReadOnlyList Path) CreateSelection( IReadOnlyDictionary variables, SelectionSetNode? selectionSet, - string? responseName) + string? responseName, + IReadOnlyList? unspecifiedArguments) { - var context = new FetchRewriterContext(Placeholder, variables, selectionSet, responseName); + var context = new FetchRewriterContext(Placeholder, variables, selectionSet, responseName, unspecifiedArguments); var selection = _rewriter.Rewrite(_field ?? (ISyntaxNode)Select, context); if (Placeholder is null && selectionSet is not null) diff --git a/src/HotChocolate/Fusion/src/Core/Planning/RequestFormatters/NodeRequestDocumentFormatter.cs b/src/HotChocolate/Fusion/src/Core/Planning/RequestFormatters/NodeRequestDocumentFormatter.cs index 2a5ff5e3a8b..4c080b292ac 100644 --- a/src/HotChocolate/Fusion/src/Core/Planning/RequestFormatters/NodeRequestDocumentFormatter.cs +++ b/src/HotChocolate/Fusion/src/Core/Planning/RequestFormatters/NodeRequestDocumentFormatter.cs @@ -24,7 +24,7 @@ internal RequestDocument CreateRequestDocument( OperationType operationType = OperationType.Query) { var rootSelectionSetNode = - CreateRooSelectionSetNode( + CreateRootSelectionSetNode( context, executionStep, entityTypeName); @@ -47,7 +47,7 @@ internal RequestDocument CreateRequestDocument( path); } - private SelectionSetNode CreateRooSelectionSetNode( + private SelectionSetNode CreateRootSelectionSetNode( QueryPlanContext context, SelectionExecutionStep executionStep, string entityTypeName) @@ -90,7 +90,8 @@ private SelectionSetNode CreateRooSelectionSetNode( var (selectionNode, _) = nodeSelection.Resolver.CreateSelection( context.VariableValues, selectionSetNode, - nodeSelection.Selection.ResponseName); + nodeSelection.Selection.ResponseName, + null); if (selectionNode is FieldNode fieldNode && !nodeSelection.Selection.ResponseName.EqualsOrdinal(fieldNode.Name.Value)) diff --git a/src/HotChocolate/Fusion/src/Core/Planning/RequestFormatters/RequestDocumentFormatter.cs b/src/HotChocolate/Fusion/src/Core/Planning/RequestFormatters/RequestDocumentFormatter.cs index c3bd46b1596..200cc9e0ddb 100644 --- a/src/HotChocolate/Fusion/src/Core/Planning/RequestFormatters/RequestDocumentFormatter.cs +++ b/src/HotChocolate/Fusion/src/Core/Planning/RequestFormatters/RequestDocumentFormatter.cs @@ -49,11 +49,14 @@ internal RequestDocument CreateRequestDocument( executionStep.Resolver, executionStep.Variables); + var unspecifiedArguments = GetUnspecifiedArguments(executionStep.ParentSelection); + var (rootResolver, p) = executionStep.Resolver.CreateSelection( context.VariableValues, rootSelectionSetNode, - null); + null, + unspecifiedArguments); rootSelectionSetNode = new SelectionSetNode(new[] { rootResolver }); path = p; @@ -85,7 +88,7 @@ internal RequestDocument CreateRequestDocument( } private SelectionSetNode CreateRootLevelQuery( - SelectionPath path, + SelectionPath path, SelectionSetNode selectionSet) { var current = path; @@ -93,11 +96,8 @@ private SelectionSetNode CreateRootLevelQuery( while (current is not null) { selectionSet = new SelectionSetNode( - new[] - { - current.Selection.SyntaxNode.WithSelectionSet(selectionSet) - }); - + new[] { current.Selection.SyntaxNode.WithSelectionSet(selectionSet) }); + current = current.Parent; } @@ -165,10 +165,13 @@ protected virtual SelectionSetNode CreateRootSelectionSetNode( rootSelection.Resolver, executionStep.Variables); + var unspecifiedArguments = GetUnspecifiedArguments(rootSelection.Selection); + var (s, _) = rootSelection.Resolver.CreateSelection( context.VariableValues, selectionSetNode, - rootSelection.Selection.ResponseName); + rootSelection.Selection.ResponseName, + unspecifiedArguments); selectionNode = s; } @@ -278,6 +281,7 @@ protected virtual SelectionSetNode CreateSelectionSetNode( selectionNodes.Add(TypeNameField); needsTypeNameField = false; } + AddInlineFragment(possibleType); } } @@ -314,7 +318,7 @@ protected virtual bool CreateSelectionNodes( ref var selection = ref selectionSet.GetSelectionsReference(); ref var end = ref Unsafe.Add(ref selection, selectionSet.Selections.Count); - while(Unsafe.IsAddressLessThan(ref selection, ref end)) + while (Unsafe.IsAddressLessThan(ref selection, ref end)) { if (!executionStep.AllSelections.Contains(selection) && !selection.Field.Name.EqualsOrdinal(IntrospectionFields.TypeName)) @@ -350,7 +354,7 @@ protected virtual bool CreateSelectionNodes( } } - NEXT: +NEXT: selection = ref Unsafe.Add(ref selection, 1)!; } @@ -428,6 +432,14 @@ protected void ResolveRequirements( } var argumentValue = selection.Arguments[argumentVariable.ArgumentName]; + + if (argumentValue.IsDefaultValue) + { + // We don't want to register and pass a value to an argument + // that wasn't explicitly specified in the original operation. + continue; + } + context.VariableValues.Add(variable.Name, argumentValue.ValueLiteral!); TryForwardVariable( context, @@ -469,9 +481,9 @@ protected void ResolveRequirements( foreach (var requirement in resolver.Requires) { - if (!context.VariableValues.ContainsKey(requirement)) + if (!context.VariableValues.ContainsKey(requirement) && + variableStateLookup.TryGetValue(requirement, out var stateKey)) { - var stateKey = variableStateLookup[requirement]; context.VariableValues.Add(requirement, new VariableNode(stateKey)); } } @@ -529,6 +541,22 @@ protected void TryForwardVariable( } } + private static IReadOnlyList? GetUnspecifiedArguments(ISelection selection) + { + List? unspecifiedArguments = null; + + foreach (var argument in selection.Arguments) + { + if (argument.IsDefaultValue) + { + unspecifiedArguments ??= new List(); + unspecifiedArguments.Add(argument.Name); + } + } + + return unspecifiedArguments; + } + private sealed class VariableVisitor : SyntaxWalker { protected override ISyntaxVisitorAction Enter( diff --git a/src/HotChocolate/Fusion/test/Core.Tests/RequestPlannerTests.cs b/src/HotChocolate/Fusion/test/Core.Tests/RequestPlannerTests.cs index ec73c10f394..165831a38ea 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/RequestPlannerTests.cs +++ b/src/HotChocolate/Fusion/test/Core.Tests/RequestPlannerTests.cs @@ -1274,6 +1274,227 @@ query Query { await snapshot.MatchAsync(); } + [Fact] + public async Task Query_Plan_32_Argument_No_Value_Specified() + { + // arrange + var fusionGraph = await FusionGraphComposer.ComposeAsync( + new[] + { + new SubgraphConfiguration( + "Test", + """ + type Query { + fieldWithEnumArg(arg: TestEnum = VALUE2): Boolean + } + + enum TestEnum { + VALUE1, + VALUE2 + } + """, + "", + new [] + { + new HttpClientConfiguration(new Uri("http://client"), "Test") + }, + null) + }); + + // act + var result = await CreateQueryPlanAsync( + fusionGraph, + """ + query Test { + fieldWithEnumArg + } + """); + + // assert + var snapshot = new Snapshot(); + snapshot.Add(result.UserRequest, nameof(result.UserRequest)); + snapshot.Add(result.QueryPlan, nameof(result.QueryPlan)); + await snapshot.MatchAsync(); + } + + [Fact] + public async Task Query_Plan_33_Argument_Default_Value_Explicitly_Specified() + { + // arrange + var fusionGraph = await FusionGraphComposer.ComposeAsync( + new[] + { + new SubgraphConfiguration( + "Test", + """ + type Query { + fieldWithEnumArg(arg: TestEnum = VALUE2): Boolean + } + + enum TestEnum { + VALUE1, + VALUE2 + } + """, + "", + new [] + { + new HttpClientConfiguration(new Uri("http://client"), "Test") + }, + null) + }); + + // act + var result = await CreateQueryPlanAsync( + fusionGraph, + """ + query Test { + fieldWithEnumArg(arg: VALUE2) + } + """); + + // assert + var snapshot = new Snapshot(); + snapshot.Add(result.UserRequest, nameof(result.UserRequest)); + snapshot.Add(result.QueryPlan, nameof(result.QueryPlan)); + await snapshot.MatchAsync(); + } + + [Fact] + public async Task Query_Plan_34_Argument_Not_Default_Value_Specified() + { + // arrange + var fusionGraph = await FusionGraphComposer.ComposeAsync( + new[] + { + new SubgraphConfiguration( + "Test", + """ + type Query { + fieldWithEnumArg(arg: TestEnum = VALUE2): Boolean + } + + enum TestEnum { + VALUE1, + VALUE2 + } + """, + "", + new [] + { + new HttpClientConfiguration(new Uri("http://client"), "Test") + }, + null) + }); + + // act + var result = await CreateQueryPlanAsync( + fusionGraph, + """ + query Test { + fieldWithEnumArg(arg: VALUE1) + } + """); + + // assert + var snapshot = new Snapshot(); + snapshot.Add(result.UserRequest, nameof(result.UserRequest)); + snapshot.Add(result.QueryPlan, nameof(result.QueryPlan)); + await snapshot.MatchAsync(); + } + + [Fact] + public async Task Query_Plan_35_Argument_Value_Variable_Specified() + { + // arrange + var fusionGraph = await FusionGraphComposer.ComposeAsync( + new[] + { + new SubgraphConfiguration( + "Test", + """ + type Query { + fieldWithEnumArg(arg: TestEnum = VALUE2): Boolean + } + + enum TestEnum { + VALUE1, + VALUE2 + } + """, + "", + new [] + { + new HttpClientConfiguration(new Uri("http://client"), "Test") + }, + null) + }); + + // act + var result = await CreateQueryPlanAsync( + fusionGraph, + """ + query Test($variable: TestEnum) { + fieldWithEnumArg(arg: $variable) + } + """); + + // assert + var snapshot = new Snapshot(); + snapshot.Add(result.UserRequest, nameof(result.UserRequest)); + snapshot.Add(result.QueryPlan, nameof(result.QueryPlan)); + await snapshot.MatchAsync(); + } + + [Fact] + public async Task Query_Plan_31_Argument_No_Value_Specified_With_Selection_Set() + { + // arrange + var fusionGraph = await FusionGraphComposer.ComposeAsync( + new[] + { + new SubgraphConfiguration( + "Test", + """ + type Query { + fieldWithEnumArg(arg: TestEnum = VALUE2): TestObject + } + + type TestObject { + test: Boolean + } + + enum TestEnum { + VALUE1, + VALUE2 + } + """, + "", + new [] + { + new HttpClientConfiguration(new Uri("http://client"), "Test") + }, + null) + }); + + // act + var result = await CreateQueryPlanAsync( + fusionGraph, + """ + query Test { + fieldWithEnumArg { + test + } + } + """); + + // assert + var snapshot = new Snapshot(); + snapshot.Add(result.UserRequest, nameof(result.UserRequest)); + snapshot.Add(result.QueryPlan, nameof(result.QueryPlan)); + await snapshot.MatchAsync(); + } + private static async Task<(DocumentNode UserRequest, Execution.Nodes.QueryPlan QueryPlan)> CreateQueryPlanAsync( Skimmed.Schema fusionGraph, [StringSyntax("graphql")] string query) diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/DemoIntegrationTests.GetFirstPage_With_After_Null.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/DemoIntegrationTests.GetFirstPage_With_After_Null.snap index cdc28804ed9..9c56b969f48 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/DemoIntegrationTests.GetFirstPage_With_After_Null.snap +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/DemoIntegrationTests.GetFirstPage_With_After_Null.snap @@ -20,7 +20,7 @@ QueryPlan { "type": "Resolve", "subgraph": "Appointment", - "document": "query AfterNull_1($after: String) { appointments(after: $after, before: null, first: null, last: null) { nodes { id } } }", + "document": "query AfterNull_1($after: String) { appointments(after: $after) { nodes { id } } }", "selectionSetId": 0, "forwardedVariables": [ { @@ -41,7 +41,7 @@ QueryPlan QueryPlan Hash --------------- -6FAD9C915B229E9D33AB4A980BEB7351BAD35924 +C601EB39A2F136D152B59B30853A0073588356FE --------------- Result diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List.snap index b29b4895308..6590a937ced 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List.snap +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List.snap @@ -22,7 +22,7 @@ QueryPlan { "type": "Resolve", "subgraph": "Appointment", - "document": "query Appointments_1 { appointments(after: null, before: null, first: null, last: null) { nodes { patient { __typename ... on Patient1 { id } ... on Patient2 { id } } } } }", + "document": "query Appointments_1 { appointments { nodes { patient { __typename ... on Patient1 { id } ... on Patient2 { id } } } } }", "selectionSetId": 0 }, { @@ -38,7 +38,7 @@ QueryPlan QueryPlan Hash --------------- -3DE1889AD56C0846C24B425F1BC050FD67F7A74B +7FA915AFBA06ABAAF57A31CE4888B161285111C3 --------------- Result diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List_With_Fragment.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List_With_Fragment.snap index e86432edcea..c409edebe1d 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List_With_Fragment.snap +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List_With_Fragment.snap @@ -25,7 +25,7 @@ QueryPlan { "type": "Resolve", "subgraph": "Appointment", - "document": "query Appointments_1 { appointments(after: null, before: null, first: null, last: null) { nodes { patient { __typename ... on Patient1 { id __fusion_exports__1: id } ... on Patient2 { id } } } } }", + "document": "query Appointments_1 { appointments { nodes { patient { __typename ... on Patient1 { id __fusion_exports__1: id } ... on Patient2 { id } } } } }", "selectionSetId": 0, "provides": [ { @@ -69,7 +69,7 @@ QueryPlan QueryPlan Hash --------------- -DDF0B84C2F5CAA3A32B14C08FDBE98CEAF7AB197 +347001780000BC39AA06AB363EB4F49993793518 --------------- Result diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List_With_Fragment_Fetch.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List_With_Fragment_Fetch.snap index e86432edcea..c409edebe1d 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List_With_Fragment_Fetch.snap +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/InterfaceTests.Query_Interface_List_With_Fragment_Fetch.snap @@ -25,7 +25,7 @@ QueryPlan { "type": "Resolve", "subgraph": "Appointment", - "document": "query Appointments_1 { appointments(after: null, before: null, first: null, last: null) { nodes { patient { __typename ... on Patient1 { id __fusion_exports__1: id } ... on Patient2 { id } } } } }", + "document": "query Appointments_1 { appointments { nodes { patient { __typename ... on Patient1 { id __fusion_exports__1: id } ... on Patient2 { id } } } } }", "selectionSetId": 0, "provides": [ { @@ -69,7 +69,7 @@ QueryPlan QueryPlan Hash --------------- -DDF0B84C2F5CAA3A32B14C08FDBE98CEAF7AB197 +347001780000BC39AA06AB363EB4F49993793518 --------------- Result diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_22_Interfaces.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_22_Interfaces.snap index d087b72742f..56b2d54c6c4 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_22_Interfaces.snap +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_22_Interfaces.snap @@ -22,7 +22,7 @@ QueryPlan { "type": "Resolve", "subgraph": "Appointment", - "document": "query Appointments_1 { appointments(after: null, before: null, first: null, last: null) { nodes { patient { __typename ... on Patient1 { id } ... on Patient2 { id } } } } }", + "document": "query Appointments_1 { appointments { nodes { patient { __typename ... on Patient1 { id } ... on Patient2 { id } } } } }", "selectionSetId": 0 }, { diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_23_Interfaces_Merge.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_23_Interfaces_Merge.snap index 8eeb36e677b..bdcc80d0761 100644 --- a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_23_Interfaces_Merge.snap +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_23_Interfaces_Merge.snap @@ -25,7 +25,7 @@ QueryPlan { "type": "Resolve", "subgraph": "Appointment", - "document": "query Appointments_1 { appointments(after: null, before: null, first: null, last: null) { nodes { patient { __typename ... on Patient1 { id __fusion_exports__1: id } ... on Patient2 { id } } } } }", + "document": "query Appointments_1 { appointments { nodes { patient { __typename ... on Patient1 { id __fusion_exports__1: id } ... on Patient2 { id } } } } }", "selectionSetId": 0, "provides": [ { diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_31_Argument_No_Value_Specified_With_Selection_Set.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_31_Argument_No_Value_Specified_With_Selection_Set.snap new file mode 100644 index 00000000000..7c52d79f80f --- /dev/null +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_31_Argument_No_Value_Specified_With_Selection_Set.snap @@ -0,0 +1,33 @@ +UserRequest +--------------- +query Test { + fieldWithEnumArg { + test + } +} +--------------- + +QueryPlan +--------------- +{ + "document": "query Test { fieldWithEnumArg { test } }", + "operation": "Test", + "rootNode": { + "type": "Sequence", + "nodes": [ + { + "type": "Resolve", + "subgraph": "Test", + "document": "query Test_1 { fieldWithEnumArg { test } }", + "selectionSetId": 0 + }, + { + "type": "Compose", + "selectionSetIds": [ + 0 + ] + } + ] + } +} +--------------- diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_32_Argument_No_Value_Specified.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_32_Argument_No_Value_Specified.snap new file mode 100644 index 00000000000..a0f58df65d2 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_32_Argument_No_Value_Specified.snap @@ -0,0 +1,31 @@ +UserRequest +--------------- +query Test { + fieldWithEnumArg +} +--------------- + +QueryPlan +--------------- +{ + "document": "query Test { fieldWithEnumArg }", + "operation": "Test", + "rootNode": { + "type": "Sequence", + "nodes": [ + { + "type": "Resolve", + "subgraph": "Test", + "document": "query Test_1 { fieldWithEnumArg }", + "selectionSetId": 0 + }, + { + "type": "Compose", + "selectionSetIds": [ + 0 + ] + } + ] + } +} +--------------- diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_33_Argument_Default_Value_Explicitly_Specified.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_33_Argument_Default_Value_Explicitly_Specified.snap new file mode 100644 index 00000000000..f7f7268523d --- /dev/null +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_33_Argument_Default_Value_Explicitly_Specified.snap @@ -0,0 +1,31 @@ +UserRequest +--------------- +query Test { + fieldWithEnumArg(arg: VALUE2) +} +--------------- + +QueryPlan +--------------- +{ + "document": "query Test { fieldWithEnumArg(arg: VALUE2) }", + "operation": "Test", + "rootNode": { + "type": "Sequence", + "nodes": [ + { + "type": "Resolve", + "subgraph": "Test", + "document": "query Test_1 { fieldWithEnumArg(arg: VALUE2) }", + "selectionSetId": 0 + }, + { + "type": "Compose", + "selectionSetIds": [ + 0 + ] + } + ] + } +} +--------------- diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_34_Argument_Not_Default_Value_Specified.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_34_Argument_Not_Default_Value_Specified.snap new file mode 100644 index 00000000000..894d16ca8f0 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_34_Argument_Not_Default_Value_Specified.snap @@ -0,0 +1,31 @@ +UserRequest +--------------- +query Test { + fieldWithEnumArg(arg: VALUE1) +} +--------------- + +QueryPlan +--------------- +{ + "document": "query Test { fieldWithEnumArg(arg: VALUE1) }", + "operation": "Test", + "rootNode": { + "type": "Sequence", + "nodes": [ + { + "type": "Resolve", + "subgraph": "Test", + "document": "query Test_1 { fieldWithEnumArg(arg: VALUE1) }", + "selectionSetId": 0 + }, + { + "type": "Compose", + "selectionSetIds": [ + 0 + ] + } + ] + } +} +--------------- diff --git a/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_35_Argument_Value_Variable_Specified.snap b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_35_Argument_Value_Variable_Specified.snap new file mode 100644 index 00000000000..da47f564762 --- /dev/null +++ b/src/HotChocolate/Fusion/test/Core.Tests/__snapshots__/RequestPlannerTests.Query_Plan_35_Argument_Value_Variable_Specified.snap @@ -0,0 +1,36 @@ +UserRequest +--------------- +query Test($variable: TestEnum) { + fieldWithEnumArg(arg: $variable) +} +--------------- + +QueryPlan +--------------- +{ + "document": "query Test($variable: TestEnum) { fieldWithEnumArg(arg: $variable) }", + "operation": "Test", + "rootNode": { + "type": "Sequence", + "nodes": [ + { + "type": "Resolve", + "subgraph": "Test", + "document": "query Test_1($variable: TestEnum) { fieldWithEnumArg(arg: $variable) }", + "selectionSetId": 0, + "forwardedVariables": [ + { + "variable": "variable" + } + ] + }, + { + "type": "Compose", + "selectionSetIds": [ + 0 + ] + } + ] + } +} +---------------