Skip to content

Commit

Permalink
Merge branch 'v8'
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane32 committed Dec 11, 2023
2 parents da93743 + dc060d1 commit 67e2834
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<ItemGroup Condition="'$(IsPackable)' == 'true'">
<None Include="..\..\assets\logo.64x64.png" Pack="true" PackagePath="\" Visible="false" />
<None Include="..\..\README.md" Pack="true" PackagePath="\" Visible="false" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions src/GraphQLParser.ApiTests/GraphQLParser.ApiTests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit" Version="2.6.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.1" />
<PackageReference Include="PublicApiGenerator" Version="11.0.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<ProjectReference Include="..\GraphQLParser\GraphQLParser.csproj" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.9" />
<PackageReference Include="BenchmarkDotNet" Version="0.13.11" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/GraphQLParser.Tests/GraphQLParser.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="Shouldly" Version="4.2.1" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
Expand Down
11 changes: 11 additions & 0 deletions src/GraphQLParser.Tests/Visitors/SDLPrinterFromParsedTextTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,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")]
Expand Down
7 changes: 5 additions & 2 deletions src/GraphQLParser/Visitors/SDLPrinter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,14 @@ protected override async ValueTask VisitFieldAsync(GraphQLField field, TContext
protected override async ValueTask VisitOperationDefinitionAsync(GraphQLOperationDefinition operationDefinition, TContext context)
{
await VisitAsync(operationDefinition.Comments, context).ConfigureAwait(false);
if (operationDefinition.Name is not null)
if (operationDefinition.Name is not null || operationDefinition.Operation != OperationType.Query)
{
await VisitAsync(LiteralNode.Wrap(GetOperationType(operationDefinition.Operation)), context).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);
Expand Down

0 comments on commit 67e2834

Please sign in to comment.