From f9af2ef4f4664b6c01c9991728ddee5480506169 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:32:05 +0300 Subject: [PATCH 1/8] Bump BenchmarkDotNet from 0.13.9 to 0.13.11 (#378) Bumps [BenchmarkDotNet](https://github.com/dotnet/BenchmarkDotNet) from 0.13.9 to 0.13.11. - [Release notes](https://github.com/dotnet/BenchmarkDotNet/releases) - [Commits](https://github.com/dotnet/BenchmarkDotNet/compare/v0.13.9...v0.13.11) --- updated-dependencies: - dependency-name: BenchmarkDotNet dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.csproj b/src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.csproj index 957f476d..df35b18b 100644 --- a/src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.csproj +++ b/src/GraphQLParser.Benchmarks/GraphQLParser.Benchmarks.csproj @@ -15,7 +15,7 @@ - + From c7043b92002763a0da55daf9be29bba98bf2bddd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:33:24 +0300 Subject: [PATCH 2/8] Bump Microsoft.NET.Test.Sdk from 17.7.2 to 17.8.0 (#369) Bumps [Microsoft.NET.Test.Sdk](https://github.com/microsoft/vstest) from 17.7.2 to 17.8.0. - [Release notes](https://github.com/microsoft/vstest/releases) - [Changelog](https://github.com/microsoft/vstest/blob/main/docs/releases.md) - [Commits](https://github.com/microsoft/vstest/compare/v17.7.2...v17.8.0) --- updated-dependencies: - dependency-name: Microsoft.NET.Test.Sdk dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj | 2 +- src/GraphQLParser.Tests/GraphQLParser.Tests.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj b/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj index c63c9328..3444148c 100644 --- a/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj +++ b/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj @@ -7,7 +7,7 @@ - + diff --git a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj index cf6de12b..c8c4ab0a 100644 --- a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj +++ b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj @@ -25,7 +25,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + From 2bf76bcf91655c84ae24ca168b5676a52a8aba70 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:33:53 +0300 Subject: [PATCH 3/8] Bump actions/github-script from 6 to 7 (#372) Bumps [actions/github-script](https://github.com/actions/github-script) from 6 to 7. - [Release notes](https://github.com/actions/github-script/releases) - [Commits](https://github.com/actions/github-script/compare/v6...v7) --- updated-dependencies: - dependency-name: actions/github-script dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/publish-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 2f32eade..874beb22 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -56,7 +56,7 @@ jobs: working-directory: src run: dotnet nuget push "out/*" -k ${{secrets.NUGET_AUTH_TOKEN}} - name: Upload Nuget packages as release artifacts - uses: actions/github-script@v6 + uses: actions/github-script@v7 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | From cda0f38a091b455994cbc3cc58065a45b7bbd729 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:34:15 +0300 Subject: [PATCH 4/8] Bump Microsoft.SourceLink.GitHub from 1.1.1 to 8.0.0 (#373) Bumps [Microsoft.SourceLink.GitHub](https://github.com/dotnet/sourcelink) from 1.1.1 to 8.0.0. - [Release notes](https://github.com/dotnet/sourcelink/releases) - [Commits](https://github.com/dotnet/sourcelink/commits) --- updated-dependencies: - dependency-name: Microsoft.SourceLink.GitHub dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/Directory.Build.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 027cff7b..f7be1336 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -30,7 +30,7 @@ - + From 93faf1b449dd5e5cd9aec9dce5c015eeeffc9f51 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:35:16 +0300 Subject: [PATCH 5/8] Bump actions/setup-dotnet from 3 to 4 (#376) Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 3 to 4. - [Release notes](https://github.com/actions/setup-dotnet/releases) - [Commits](https://github.com/actions/setup-dotnet/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/setup-dotnet dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/publish-preview.yml | 2 +- .github/workflows/publish-release.yml | 2 +- .github/workflows/test.yml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bde6f82d..e596f820 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -19,7 +19,7 @@ jobs: show-progress: false - name: Setup .NET SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: 7.0.x diff --git a/.github/workflows/publish-preview.yml b/.github/workflows/publish-preview.yml index 92da5134..c5eaa3db 100644 --- a/.github/workflows/publish-preview.yml +++ b/.github/workflows/publish-preview.yml @@ -25,7 +25,7 @@ jobs: with: show-progress: false - name: Setup .NET SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: 7.0.x source-url: https://nuget.pkg.github.com/graphql-dotnet/index.json diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 874beb22..f39ce602 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -31,7 +31,7 @@ jobs: echo version=$version echo "version=$version" >> $GITHUB_ENV - name: Setup .NET SDK - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: 7.0.x source-url: https://api.nuget.org/v3/index.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fba533a4..6b85b1b5 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -35,7 +35,7 @@ jobs: with: show-progress: false - name: Setup .NET SDKs - uses: actions/setup-dotnet@v3 + uses: actions/setup-dotnet@v4 with: dotnet-version: | 3.1.x From 77f8a315e4d7498d59c6439b1448607d9592985d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:35:31 +0300 Subject: [PATCH 6/8] Bump actions/labeler from 4 to 5 (#377) Bumps [actions/labeler](https://github.com/actions/labeler) from 4 to 5. - [Release notes](https://github.com/actions/labeler/releases) - [Commits](https://github.com/actions/labeler/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/labeler dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/label.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 30ef4f73..421efaf5 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -15,7 +15,7 @@ jobs: label: runs-on: ubuntu-latest steps: - - uses: actions/labeler@v4 + - uses: actions/labeler@v5 with: sync-labels: "" repo-token: "${{ secrets.GITHUB_TOKEN }}" From caffc33ee11b0dd4b892acf12f33216cdfe13ed0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 11 Dec 2023 11:43:37 +0300 Subject: [PATCH 7/8] Bump xunit from 2.5.3 to 2.6.3 (#379) Bumps [xunit](https://github.com/xunit/xunit) from 2.5.3 to 2.6.3. - [Commits](https://github.com/xunit/xunit/compare/2.5.3...2.6.3) --- updated-dependencies: - dependency-name: xunit dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj b/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj index 3444148c..766a3497 100644 --- a/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj +++ b/src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj @@ -9,7 +9,7 @@ - + From dc060d1b35ea40494c1a51bd588d49e018c3f5b8 Mon Sep 17 00:00:00 2001 From: Shane Krueger Date: Mon, 11 Dec 2023 04:01:06 -0500 Subject: [PATCH 8/8] Fix printing operation type (#371) --- src/GraphQLParser.Tests/Visitors/SDLPrinterTests.cs | 11 +++++++++++ src/GraphQLParser/Visitors/SDLPrinter.cs | 7 +++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/GraphQLParser.Tests/Visitors/SDLPrinterTests.cs b/src/GraphQLParser.Tests/Visitors/SDLPrinterTests.cs index 27a445f0..3457a0fd 100644 --- a/src/GraphQLParser.Tests/Visitors/SDLPrinterTests.cs +++ b/src/GraphQLParser.Tests/Visitors/SDLPrinterTests.cs @@ -813,6 +813,17 @@ public void UTF8_MemoryStream_Runs_Synchronously() printer.PrintAsync(document, writer).IsCompletedSuccessfully.ShouldBeTrue(); } + [Theory] + [InlineData("{ field1 }", "{\n field1\n}")] + [InlineData("query { field1 }", "{\n field1\n}")] + [InlineData("query q1 { field1 }", "query q1 {\n field1\n}")] + [InlineData("mutation { field1 }", "mutation {\n field1\n}")] + [InlineData("mutation m1 { field1 }", "mutation m1 {\n field1\n}")] + public void OperationPrints(string input, string expected) + { + new SDLPrinter().Print(Parser.Parse(input)).ShouldBe(expected, StringCompareShould.IgnoreLineEndings); + } + [Theory] [InlineData("query a { name }")] [InlineData("directive @skip(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT")] diff --git a/src/GraphQLParser/Visitors/SDLPrinter.cs b/src/GraphQLParser/Visitors/SDLPrinter.cs index cdd4a40e..a7912594 100644 --- a/src/GraphQLParser/Visitors/SDLPrinter.cs +++ b/src/GraphQLParser/Visitors/SDLPrinter.cs @@ -331,11 +331,14 @@ protected override async ValueTask VisitOperationDefinitionAsync(GraphQLOperatio } await VisitAsync(operationDefinition.Comments, context).ConfigureAwait(false); - if (operationDefinition.Name is not null) + if (operationDefinition.Name is not null || operationDefinition.Operation != OperationType.Query) { await context.WriteAsync(GetOperationType(operationDefinition.Operation)).ConfigureAwait(false); await context.WriteAsync(" ").ConfigureAwait(false); - await VisitAsync(operationDefinition.Name, context).ConfigureAwait(false); + if (operationDefinition.Name is not null) + { + await VisitAsync(operationDefinition.Name, context).ConfigureAwait(false); + } } await VisitAsync(operationDefinition.Variables, context).ConfigureAwait(false); await VisitAsync(operationDefinition.Directives, context).ConfigureAwait(false);