From 178d4e786ba619dee7b53b709e32166bffc16e4f Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Mon, 11 Dec 2023 17:37:11 +0300 Subject: [PATCH 1/3] Cosmetic changes (#380) --- README.md | 11 +++--- .../Visitors/SDLPrinterSkipDirectivesTests.cs | 2 +- .../Visitors/SDLPrinterTests.cs | 34 +++++++++---------- .../SDLPrinterVerticalIndentationTests.cs | 2 +- .../Visitors/StructurePrinterTests.cs | 6 ++-- 5 files changed, 28 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 3e72b4b8..2f8b7e08 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Preview versions of this package are available on [GitHub Packages](https://gith Generates token based on input text. Lexer takes advantage of `ReadOnlyMemory` and in most cases does not allocate memory on the managed heap at all. -### Usage +Usage: ```csharp var token = Lexer.Lex("\"str\""); @@ -36,7 +36,7 @@ Lex method always returns the first token it finds. In this case case the result Parses provided GraphQL expression into AST (abstract syntax tree). Parser also takes advantage of `ReadOnlyMemory` but still allocates memory for AST. -### Usage +Usage: ```csharp var ast1 = Parser.Parse(@" @@ -84,7 +84,8 @@ new SDLPrinter().Print(document, sb); // print to a string with some options var sdlPrinter = new SDLPrinter( - new SDLPrinterOptions { + new SDLPrinterOptions + { PrintComments = true, EachDirectiveLocationOnNewLine = true, EachUnionMemberOnNewLine = true, @@ -111,8 +112,8 @@ query { ### SDLSorter An AST document can be sorted with the `SDLSorter` using a predefined -sort order. You can specify the string comparison; by default it uses -a culture-invariant case-insensitive comparison. Any futher customization +sort order. You can specify the string comparison; by default it uses +a culture-invariant case-insensitive comparison. Any futher customization is possible by deriving from `SDLSorterOptions` and overriding the `Compare` methods. diff --git a/src/GraphQLParser.Tests/Visitors/SDLPrinterSkipDirectivesTests.cs b/src/GraphQLParser.Tests/Visitors/SDLPrinterSkipDirectivesTests.cs index 63958bcd..5cf016af 100644 --- a/src/GraphQLParser.Tests/Visitors/SDLPrinterSkipDirectivesTests.cs +++ b/src/GraphQLParser.Tests/Visitors/SDLPrinterSkipDirectivesTests.cs @@ -51,7 +51,7 @@ public async Task Printer_Should_Print_Pretty_If_Directives_Skipped( string expected) { var printer = new MyPrinter(); - var writer = new StringWriter(); + using var writer = new StringWriter(); var document = text.Parse(); await printer.PrintAsync(document, writer); diff --git a/src/GraphQLParser.Tests/Visitors/SDLPrinterTests.cs b/src/GraphQLParser.Tests/Visitors/SDLPrinterTests.cs index 3457a0fd..5b7cd069 100644 --- a/src/GraphQLParser.Tests/Visitors/SDLPrinterTests.cs +++ b/src/GraphQLParser.Tests/Visitors/SDLPrinterTests.cs @@ -10,7 +10,7 @@ public async Task Print_Matches_PrintAsync_String() { var query = "KitchenSink".ReadGraphQLFile().Parse(); var writer = new SDLPrinter(); - var sw = new StringWriter(); + using var sw = new StringWriter(); await writer.PrintAsync(query, sw); sw.Flush(); var txt = sw.ToString(); @@ -580,7 +580,7 @@ public async Task SDLPrinter_Should_Print_Document( EachDirectiveLocationOnNewLine = eachDirectiveLocationOnNewLine, EachUnionMemberOnNewLine = eachUnionMemberOnNewLine }); - var writer = new StringWriter(); + using var writer = new StringWriter(); var document = text.Parse(); await printer.PrintAsync(document, writer); @@ -636,7 +636,7 @@ public async Task SDLPrinter_Should_Print_BlockStrings(int number, string input, ? "\"\"\"" + expected + "\"\"\"" : "\"" + expected + "\""; - var writer = new StringWriter(); + using var writer = new StringWriter(); var document = (input + " scalar a").Parse(); @@ -667,7 +667,7 @@ public async Task SDLPrinter_Should_Print_EscapedStrings(string stringValue) string expected = @$"{{ a(p: {stringValue}) }}"; - var writer = new StringWriter(); + using var writer = new StringWriter(); var document = query.Parse(); @@ -683,16 +683,16 @@ public async Task SDLPrinter_Should_Print_EscapedStrings(string stringValue) public async Task SelectionSet_Without_Parent_Should_Be_Printed_On_New_Line() { var selectionSet = new GraphQLSelectionSetWithComment { Selections = new List() }; - var writer = new StringWriter(); + using var writer = new StringWriter(); var printer = new SDLPrinter(new SDLPrinterOptions { PrintComments = true }); await printer.PrintAsync(selectionSet, writer); writer.ToString().ShouldBe(@"{ } "); selectionSet.Comments = new List { new GraphQLComment("comment") }; - writer = new StringWriter(); - await printer.PrintAsync(selectionSet, writer); - writer.ToString().ShouldBe(@"#comment + using var writer2 = new StringWriter(); + await printer.PrintAsync(selectionSet, writer2); + writer2.ToString().ShouldBe(@"#comment { } "); @@ -705,15 +705,15 @@ public async Task SelectionSet_Under_Operation_With_Null_Name_Should_Be_Printed_ { SelectionSet = new GraphQLSelectionSetWithComment { Selections = new List() } }; - var writer = new StringWriter(); + using var writer = new StringWriter(); var printer = new SDLPrinter(new SDLPrinterOptions { PrintComments = true }); await printer.PrintAsync(def, writer); writer.ToString().ShouldBe(@"{ }"); def.SelectionSet.Comments = new List { new GraphQLComment("comment") }; - writer = new StringWriter(); - await printer.PrintAsync(def, writer); - writer.ToString().ShouldBe(@"#comment + using var writer2 = new StringWriter(); + await printer.PrintAsync(def, writer2); + writer2.ToString().ShouldBe(@"#comment { }"); } @@ -734,7 +734,7 @@ public async Task SelectionSet_Under_Operation_With_Null_Name_Should_Be_Printed_ public async Task Description_Without_Parent_Should_Be_Printed(string text, string expected) { var description = new GraphQLDescription(text); - var writer = new StringWriter(); + using var writer = new StringWriter(); var printer = new SDLPrinter(); await printer.PrintAsync(description, writer); writer.ToString().ShouldBe(expected); @@ -761,7 +761,7 @@ Line 4 public async Task Description_With_Escaped_Unicode_Should_Be_Printed(string text, string expected) { var description = new GraphQLDescription(text); - var writer = new StringWriter(); + using var writer = new StringWriter(); var printer = new SDLPrinter(); await printer.PrintAsync(description, writer); writer.ToString().ShouldBe(expected); @@ -777,7 +777,7 @@ public async Task InputValueDefinition_Without_Parent_Should_Be_Printed() DefaultValue = new GraphQLStringValue("abc") }; - var writer = new StringWriter(); + using var writer = new StringWriter(); var printer = new SDLPrinter(); await printer.PrintAsync(def, writer); writer.ToString().ShouldBe("field: String = \"abc\""); @@ -787,7 +787,7 @@ public async Task InputValueDefinition_Without_Parent_Should_Be_Printed() public async Task Directive_Without_Parent_Should_Be_Printed() { var directive = new GraphQLDirective { Name = new GraphQLName("upper") }; - var writer = new StringWriter(); + using var writer = new StringWriter(); var printer = new SDLPrinter(); await printer.PrintAsync(directive, writer); writer.ToString().ShouldBe("@upper"); @@ -829,7 +829,7 @@ public void OperationPrints(string input, string expected) [InlineData("directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT")] public async Task SDLPrinter_Should_Throw_On_Unknown_Values(string text) { - var writer = new StringWriter(); + using var writer = new StringWriter(); var document = text.Parse(); await new DoBadThingsVisitor().VisitAsync(document, new Context()); diff --git a/src/GraphQLParser.Tests/Visitors/SDLPrinterVerticalIndentationTests.cs b/src/GraphQLParser.Tests/Visitors/SDLPrinterVerticalIndentationTests.cs index 9c24adad..43a3db60 100644 --- a/src/GraphQLParser.Tests/Visitors/SDLPrinterVerticalIndentationTests.cs +++ b/src/GraphQLParser.Tests/Visitors/SDLPrinterVerticalIndentationTests.cs @@ -183,7 +183,7 @@ public async Task Printer_Should_Print_Pretty_If_Definitions_Skipped( string expected) { var printer = new MyPrinter(); - var writer = new StringWriter(); + using var writer = new StringWriter(); var document = text.Parse(); await printer.PrintAsync(document, writer); diff --git a/src/GraphQLParser.Tests/Visitors/StructurePrinterTests.cs b/src/GraphQLParser.Tests/Visitors/StructurePrinterTests.cs index fd1eabcd..5ecb3fc2 100644 --- a/src/GraphQLParser.Tests/Visitors/StructurePrinterTests.cs +++ b/src/GraphQLParser.Tests/Visitors/StructurePrinterTests.cs @@ -283,7 +283,7 @@ Name [dir] ")] public async Task StructurePrinter_Should_Print_Tree(string text, string expected) { - var writer = new StringWriter(); + using var writer = new StringWriter(); var document = text.Parse(); await _structPrinter1.PrintAsync(document, writer); var actual = writer.ToString(); @@ -302,7 +302,7 @@ public async Task StructurePrinter_Should_Print_Tree(string text, string expecte ")] public async Task StructurePrinter_Should_Print_Tree_Without_Names(string text, string expected) { - var writer = new StringWriter(); + using var writer = new StringWriter(); var document = text.Parse(); await _structPrinter2.PrintAsync(document, writer); var actual = writer.ToString(); @@ -547,7 +547,7 @@ public async Task StructurePrinter_Should_Print_Tree_With_Locations(string text, if (option == IgnoreOptions.Comments && !ignoreComments) continue; - var writer = new StringWriter(); + using var writer = new StringWriter(); var document = text.Parse(new ParserOptions { Ignore = option }); await _structPrinter3.PrintAsync(document, writer); From 8de2491eb4cf831bb3751c7dc75284f9bbb4fef8 Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Mon, 11 Dec 2023 17:37:23 +0300 Subject: [PATCH 2/3] Bump xunit packages and PublicApiGenerator (#381) * Bump xunit packages and PublicApiGenerator * remove 3.1 --- .github/workflows/test.yml | 1 - src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj | 4 ++-- src/GraphQLParser.Tests/GraphQLParser.Tests.csproj | 6 +++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6b85b1b5..ac707085 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -38,7 +38,6 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 3.1.x 6.0.x 7.0.x source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json diff --git a/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj b/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj index 766a3497..c7493e21 100644 --- a/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj +++ b/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj @@ -10,8 +10,8 @@ - - + + diff --git a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj index c8c4ab0a..465cf9ed 100644 --- a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj +++ b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj @@ -12,7 +12,7 @@ - netcoreapp3.1;net6;net7 + net6;net7 $(TargetFrameworks);net462 @@ -27,8 +27,8 @@ - - + + From aa5475e2b19fe49d43518e8b872bedc3d7dadeda Mon Sep 17 00:00:00 2001 From: Ivan Maximov Date: Mon, 11 Dec 2023 17:43:19 +0300 Subject: [PATCH 3/3] Migrate to NET8 (#382) * Migrate to NET8 * format * Update --------- Co-authored-by: Shane Krueger --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/publish-preview.yml | 2 +- .github/workflows/publish-release.yml | 2 +- .github/workflows/test.yml | 6 +- .../ApiApprovalTests.cs | 2 +- .../GraphQLParser.ApiTests.csproj | 2 +- .../GraphQLParser.Benchmarks.csproj | 2 +- .../GraphQLParser.Tests.csproj | 2 +- src/GraphQLParser.Tests/NodeHelperTests.cs | 16 ++--- src/GraphQLParser/ParserContext.cs | 68 +++++++++---------- src/GraphQLParser/Visitors/SDLPrinter.cs | 40 +++++++++-- 11 files changed, 86 insertions(+), 58 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e596f820..5bf5bb71 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -21,7 +21,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Initialize CodeQL uses: github/codeql-action/init@v2 diff --git a/.github/workflows/publish-preview.yml b/.github/workflows/publish-preview.yml index c5eaa3db..bb5ad5c4 100644 --- a/.github/workflows/publish-preview.yml +++ b/.github/workflows/publish-preview.yml @@ -27,7 +27,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index f39ce602..8b09bb5b 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -33,7 +33,7 @@ jobs: - name: Setup .NET SDK uses: actions/setup-dotnet@v4 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x source-url: https://api.nuget.org/v3/index.json env: NUGET_AUTH_TOKEN: ${{secrets.NUGET_AUTH_TOKEN}} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac707085..a5c3cb85 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,12 +40,10 @@ jobs: dotnet-version: | 6.0.x 7.0.x + 8.0.x source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json env: NUGET_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} - - name: Disable MSVS Nuget Source # see https://github.com/graphql-dotnet/graphql-dotnet/issues/2422 - if: ${{ startsWith(matrix.os, 'windows') }} - run: dotnet nuget disable source 'Microsoft Visual Studio Offline Packages' - name: Install dependencies working-directory: src run: dotnet restore @@ -72,7 +70,7 @@ jobs: if: ${{ startsWith(matrix.os, 'ubuntu') }} uses: codecov/codecov-action@v3 with: - files: .coverage/GraphQLParser.Tests/coverage.net5.opencover.xml + files: .coverage/GraphQLParser.Tests/coverage.net8.opencover.xml buildcheck: needs: diff --git a/src/GraphQLParser.ApiTests/ApiApprovalTests.cs b/src/GraphQLParser.ApiTests/ApiApprovalTests.cs index f8dc6a11..ac042bf9 100644 --- a/src/GraphQLParser.ApiTests/ApiApprovalTests.cs +++ b/src/GraphQLParser.ApiTests/ApiApprovalTests.cs @@ -34,7 +34,7 @@ public void Public_Api_Should_Not_Change_Inadvertently(Type type) { IncludeAssemblyAttributes = false, //WhitelistedNamespacePrefixes = new[] { "Microsoft.Extensions.DependencyInjection" }, - ExcludeAttributes = new[] { "System.Diagnostics.DebuggerDisplayAttribute", "System.Diagnostics.CodeAnalysis.AllowNullAttribute" } + ExcludeAttributes = ["System.Diagnostics.DebuggerDisplayAttribute", "System.Diagnostics.CodeAnalysis.AllowNullAttribute"] }))).ToArray(); if (publicApi.DistinctBy(item => item.content).Count() == 1) diff --git a/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj b/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj index c7493e21..da8187a2 100644 --- a/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj +++ b/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj @@ -1,7 +1,7 @@ - net7 + net8 $(NoWarn);1591 enable diff --git a/src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.csproj b/src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.csproj index df35b18b..19d9b78d 100644 --- a/src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.csproj +++ b/src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.csproj @@ -1,7 +1,7 @@ - net7 + net8 Exe false $(NoWarn);1591 diff --git a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj index 465cf9ed..715750f0 100644 --- a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj +++ b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj @@ -12,7 +12,7 @@ - net6;net7 + net6;net7;net8 $(TargetFrameworks);net462 diff --git a/src/GraphQLParser.Tests/NodeHelperTests.cs b/src/GraphQLParser.Tests/NodeHelperTests.cs index 0d17b0d1..51d3fbf5 100644 --- a/src/GraphQLParser.Tests/NodeHelperTests.cs +++ b/src/GraphQLParser.Tests/NodeHelperTests.cs @@ -8,8 +8,8 @@ public void NodeHelper_Should_Return_Proper_Nodes_1() foreach (var method in typeof(NodeHelper).GetMethods().Where(m => m.IsStatic)) { var node = method.GetParameters().Length == 1 - ? (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.None }) - : (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.None, Activator.CreateInstance(method.GetParameters()[1].ParameterType) }); + ? (ASTNode)method.Invoke(null, [IgnoreOptions.None]) + : (ASTNode)method.Invoke(null, [IgnoreOptions.None, Activator.CreateInstance(method.GetParameters()[1].ParameterType)]); node.Comments = new List { new GraphQLComment("abcdef") }; if (node is not GraphQLComment && @@ -29,8 +29,8 @@ public void NodeHelper_Should_Return_Proper_Nodes_2() foreach (var method in typeof(NodeHelper).GetMethods().Where(m => m.IsStatic)) { var node = method.GetParameters().Length == 1 - ? (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.Comments }) - : (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.Comments, Activator.CreateInstance(method.GetParameters()[1].ParameterType) }); + ? (ASTNode)method.Invoke(null, [IgnoreOptions.Comments]) + : (ASTNode)method.Invoke(null, [IgnoreOptions.Comments, Activator.CreateInstance(method.GetParameters()[1].ParameterType)]); node.Comments = new List { new GraphQLComment("abcdef") }; node.Comment.ShouldBeNull(); @@ -46,8 +46,8 @@ public void NodeHelper_Should_Return_Proper_Nodes_3() foreach (var method in typeof(NodeHelper).GetMethods().Where(m => m.IsStatic)) { var node = method.GetParameters().Length == 1 - ? (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.Locations }) - : (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.Locations, Activator.CreateInstance(method.GetParameters()[1].ParameterType) }); + ? (ASTNode)method.Invoke(null, [IgnoreOptions.Locations]) + : (ASTNode)method.Invoke(null, [IgnoreOptions.Locations, Activator.CreateInstance(method.GetParameters()[1].ParameterType)]); node.Comments = new List { new GraphQLComment("abcdef") }; if (node is not GraphQLComment && @@ -67,8 +67,8 @@ public void NodeHelper_Should_Return_Proper_Nodes_4() foreach (var method in typeof(NodeHelper).GetMethods().Where(m => m.IsStatic)) { var node = method.GetParameters().Length == 1 - ? (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.All }) - : (ASTNode)method.Invoke(null, new object[] { IgnoreOptions.All, Activator.CreateInstance(method.GetParameters()[1].ParameterType) }); + ? (ASTNode)method.Invoke(null, [IgnoreOptions.All]) + : (ASTNode)method.Invoke(null, [IgnoreOptions.All, Activator.CreateInstance(method.GetParameters()[1].ParameterType)]); node.Comments = new List { new GraphQLComment("abcdef") }; node.Comment.ShouldBeNull(); diff --git a/src/GraphQLParser/ParserContext.cs b/src/GraphQLParser/ParserContext.cs index e83c7a3c..1eb27ea1 100644 --- a/src/GraphQLParser/ParserContext.cs +++ b/src/GraphQLParser/ParserContext.cs @@ -9,8 +9,8 @@ namespace GraphQLParser; internal ref partial struct ParserContext { - private static string[] TopLevelKeywordOneOf { get; set; } = new[] - { + private static string[] TopLevelKeywordOneOf { get; set; } = + [ "query", "mutation", "subscription", @@ -24,10 +24,10 @@ internal ref partial struct ParserContext "input", "extend", "directive", - }; + ]; - private static string[] TypeExtensionOneOf { get; set; } = new[] - { + private static string[] TypeExtensionOneOf { get; set; } = + [ "schema", "scalar", "type", @@ -35,39 +35,39 @@ internal ref partial struct ParserContext "union", "enum", "input", - }; + ]; - private static string[] OperationTypeOneOf { get; set; } = new[] - { + private static string[] OperationTypeOneOf { get; set; } = + [ "query", "mutation", "subscription", - }; - - private static string[] DirectiveLocationOneOf { get; set; } = new[] - { - // http://spec.graphql.org/June2018/#ExecutableDirectiveLocation - "QUERY", - "MUTATION", - "SUBSCRIPTION", - "FIELD", - "FRAGMENT_DEFINITION", - "FRAGMENT_SPREAD", - "INLINE_FRAGMENT", - "VARIABLE_DEFINITION", - // http://spec.graphql.org/June2018/#TypeSystemDirectiveLocation - "SCHEMA", - "SCALAR", - "OBJECT", - "FIELD_DEFINITION", - "ARGUMENT_DEFINITION", - "INTERFACE", - "UNION", - "ENUM", - "ENUM_VALUE", - "INPUT_OBJECT", - "INPUT_FIELD_DEFINITION", - }; + ]; + + private static string[] DirectiveLocationOneOf { get; set; } = + [ + // http://spec.graphql.org/June2018/#ExecutableDirectiveLocation + "QUERY", + "MUTATION", + "SUBSCRIPTION", + "FIELD", + "FRAGMENT_DEFINITION", + "FRAGMENT_SPREAD", + "INLINE_FRAGMENT", + "VARIABLE_DEFINITION", + // http://spec.graphql.org/June2018/#TypeSystemDirectiveLocation + "SCHEMA", + "SCALAR", + "OBJECT", + "FIELD_DEFINITION", + "ARGUMENT_DEFINITION", + "INTERFACE", + "UNION", + "ENUM", + "ENUM_VALUE", + "INPUT_OBJECT", + "INPUT_FIELD_DEFINITION", + ]; private delegate TResult ParseCallback(ref ParserContext context); diff --git a/src/GraphQLParser/Visitors/SDLPrinter.cs b/src/GraphQLParser/Visitors/SDLPrinter.cs index a7912594..4cd0c0e9 100644 --- a/src/GraphQLParser/Visitors/SDLPrinter.cs +++ b/src/GraphQLParser/Visitors/SDLPrinter.cs @@ -1135,11 +1135,41 @@ private static bool TryPeekParent(TContext context, [NotNullWhen(true)] out ASTN return true; } - private static readonly string[] _hex32 = new[] - { - "\\u0000", "\\u0001", "\\u0002", "\\u0003", "\\u0004", "\\u0005", "\\u0006", "\\u0007", "\\u0008", "\\u0009", "\\u000A", "\\u000B", "\\u000C", "\\u000D", "\\u000E", "\\u000F", - "\\u0010", "\\u0011", "\\u0012", "\\u0013", "\\u0014", "\\u0015", "\\u0016", "\\u0017", "\\u0018", "\\u0019", "\\u001A", "\\u001B", "\\u001C", "\\u001D", "\\u001E", "\\u001F" - }; + private static readonly string[] _hex32 = + [ + "\\u0000", + "\\u0001", + "\\u0002", + "\\u0003", + "\\u0004", + "\\u0005", + "\\u0006", + "\\u0007", + "\\u0008", + "\\u0009", + "\\u000A", + "\\u000B", + "\\u000C", + "\\u000D", + "\\u000E", + "\\u000F", + "\\u0010", + "\\u0011", + "\\u0012", + "\\u0013", + "\\u0014", + "\\u0015", + "\\u0016", + "\\u0017", + "\\u0018", + "\\u0019", + "\\u001A", + "\\u001B", + "\\u001C", + "\\u001D", + "\\u001E", + "\\u001F" + ]; // http://spec.graphql.org/October2021/#StringCharacter private static async ValueTask WriteEncodedStringAsync(TContext context, ROM value)