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 6b85b1b5..1709ead7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,12 +41,10 @@ jobs: 3.1.x 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 @@ -73,7 +71,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 766a3497..041910a8 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 c8c4ab0a..37f8fddf 100644 --- a/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj +++ b/src/GraphQLParser.Tests/GraphQLParser.Tests.csproj @@ -12,7 +12,7 @@ - netcoreapp3.1;net6;net7 + netcoreapp3.1;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..ae4d5ab8 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,17 +35,17 @@ 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[] - { + private static string[] DirectiveLocationOneOf { get; set; } = + [ // http://spec.graphql.org/June2018/#ExecutableDirectiveLocation "QUERY", "MUTATION", @@ -67,7 +67,7 @@ internal ref partial struct ParserContext "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..0ab195e6 100644 --- a/src/GraphQLParser/Visitors/SDLPrinter.cs +++ b/src/GraphQLParser/Visitors/SDLPrinter.cs @@ -1135,11 +1135,11 @@ private static bool TryPeekParent(TContext context, [NotNullWhen(true)] out ASTN return true; } - private static readonly string[] _hex32 = new[] - { + 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)