diff --git a/.github/workflows/branches.yml b/.github/workflows/branches.yml index 52a0b4c1..8ae6f0f8 100644 --- a/.github/workflows/branches.yml +++ b/.github/workflows/branches.yml @@ -25,7 +25,7 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 7.0.x + 8.0.x - name: Restore dotnet tools run: dotnet tool restore - name: Fetch complete repository including tags diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 4803f900..b26156bb 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -23,7 +23,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.yml b/.github/workflows/publish.yml index eb5df29b..bbb89933 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.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://api.nuget.org/v3/index.json env: NUGET_AUTH_TOKEN: ${{secrets.NUGET_API_KEY}} diff --git a/GraphQL.Client.sln b/GraphQL.Client.sln index 89782ecc..af2fd372 100644 --- a/GraphQL.Client.sln +++ b/GraphQL.Client.sln @@ -32,6 +32,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{ ProjectSection(SolutionItems) = preProject .github\workflows\branches.yml = .github\workflows\branches.yml .github\workflows\master.yml = .github\workflows\master.yml + .github\workflows\publish.yml = .github\workflows\publish.yml EndProjectSection EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Primitives", "src\GraphQL.Primitives\GraphQL.Primitives.csproj", "{87FC440E-6A4D-47D8-9EB2-416FC31CC4A6}" diff --git a/GraphQL.Client.sln.DotSettings b/GraphQL.Client.sln.DotSettings new file mode 100644 index 00000000..9e5ec22f --- /dev/null +++ b/GraphQL.Client.sln.DotSettings @@ -0,0 +1,2 @@ + + QL \ No newline at end of file diff --git a/src/GraphQL.Client.LocalExecution/GraphQL.Client.LocalExecution.csproj b/src/GraphQL.Client.LocalExecution/GraphQL.Client.LocalExecution.csproj index 81bc57c3..687cc656 100644 --- a/src/GraphQL.Client.LocalExecution/GraphQL.Client.LocalExecution.csproj +++ b/src/GraphQL.Client.LocalExecution/GraphQL.Client.LocalExecution.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/GraphQL.Client.Serializer.SystemTextJson/GraphQL.Client.Serializer.SystemTextJson.csproj b/src/GraphQL.Client.Serializer.SystemTextJson/GraphQL.Client.Serializer.SystemTextJson.csproj index bd570172..2a436c50 100644 --- a/src/GraphQL.Client.Serializer.SystemTextJson/GraphQL.Client.Serializer.SystemTextJson.csproj +++ b/src/GraphQL.Client.Serializer.SystemTextJson/GraphQL.Client.Serializer.SystemTextJson.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/GraphQL.Client/GraphQLHttpRequest.cs b/src/GraphQL.Client/GraphQLHttpRequest.cs index 986f1dd5..b89d1814 100644 --- a/src/GraphQL.Client/GraphQLHttpRequest.cs +++ b/src/GraphQL.Client/GraphQLHttpRequest.cs @@ -1,52 +1,53 @@ -#pragma warning disable IDE0005 -// see https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/implicit-global-using-netfx -using System.Net.Http; -#pragma warning restore IDE0005 -using System.Net.Http.Headers; -using System.Text; -using GraphQL.Client.Abstractions; - -namespace GraphQL.Client.Http; - -public class GraphQLHttpRequest : GraphQLRequest -{ - public GraphQLHttpRequest() - { - } - - public GraphQLHttpRequest(string query, object? variables = null, string? operationName = null, Dictionary? extensions = null) - : base(query, variables, operationName, extensions) - { - } - - public GraphQLHttpRequest(GraphQLRequest other) - : base(other) - { - } - - /// - /// Creates a from this . - /// Used by to convert GraphQL requests when sending them as regular HTTP requests. - /// - /// the passed from - /// the passed from - /// - public virtual HttpRequestMessage ToHttpRequestMessage(GraphQLHttpClientOptions options, IGraphQLJsonSerializer serializer) - { - var message = new HttpRequestMessage(HttpMethod.Post, options.EndPoint) - { - Content = new StringContent(serializer.SerializeToString(this), Encoding.UTF8, options.MediaType) - }; - message.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/graphql-response+json")); - message.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); +#pragma warning disable IDE0005 +// see https://learn.microsoft.com/en-us/dotnet/core/compatibility/sdk/8.0/implicit-global-using-netfx +using System.Diagnostics.CodeAnalysis; +using System.Net.Http; +#pragma warning restore IDE0005 +using System.Net.Http.Headers; +using System.Text; +using GraphQL.Client.Abstractions; + +namespace GraphQL.Client.Http; + +public class GraphQLHttpRequest : GraphQLRequest +{ + public GraphQLHttpRequest() + { + } + + public GraphQLHttpRequest([StringSyntax("GraphQL")] string query, object? variables = null, string? operationName = null, Dictionary? extensions = null) + : base(query, variables, operationName, extensions) + { + } + + public GraphQLHttpRequest(GraphQLRequest other) + : base(other) + { + } + + /// + /// Creates a from this . + /// Used by to convert GraphQL requests when sending them as regular HTTP requests. + /// + /// the passed from + /// the passed from + /// + public virtual HttpRequestMessage ToHttpRequestMessage(GraphQLHttpClientOptions options, IGraphQLJsonSerializer serializer) + { + var message = new HttpRequestMessage(HttpMethod.Post, options.EndPoint) + { + Content = new StringContent(serializer.SerializeToString(this), Encoding.UTF8, options.MediaType) + }; + message.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/graphql-response+json")); + message.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); message.Headers.AcceptCharset.Add(new StringWithQualityHeaderValue("utf-8")); // Explicitly setting content header to avoid issues with some GrahQL servers - message.Content.Headers.ContentType = new MediaTypeHeaderValue(options.MediaType); - - if (options.DefaultUserAgentRequestHeader != null) - message.Headers.UserAgent.Add(options.DefaultUserAgentRequestHeader); - - return message; - } -} + message.Content.Headers.ContentType = new MediaTypeHeaderValue(options.MediaType); + + if (options.DefaultUserAgentRequestHeader != null) + message.Headers.UserAgent.Add(options.DefaultUserAgentRequestHeader); + + return message; + } +} diff --git a/src/GraphQL.Primitives/StringSyntaxAttribute.cs b/src/GraphQL.Primitives/StringSyntaxAttribute.cs index 8ea74c0e..76e5b5e4 100644 --- a/src/GraphQL.Primitives/StringSyntaxAttribute.cs +++ b/src/GraphQL.Primitives/StringSyntaxAttribute.cs @@ -1,5 +1,6 @@ #if !NET7_0_OR_GREATER +// ReSharper disable once CheckNamespace namespace System.Diagnostics.CodeAnalysis; /// @@ -7,11 +8,14 @@ namespace System.Diagnostics.CodeAnalysis; /// public sealed class StringSyntaxAttribute : Attribute { + // ReSharper disable once InconsistentNaming +#pragma warning disable IDE1006 public const string CompositeFormat = nameof(CompositeFormat); +#pragma warning restore IDE1006 +#pragma warning disable IDE0060 public StringSyntaxAttribute(string syntax) - { - } - + { } +#pragma warning restore IDE0060 } #endif diff --git a/tests/GraphQL.Client.Serializer.Tests/GraphQL.Client.Serializer.Tests.csproj b/tests/GraphQL.Client.Serializer.Tests/GraphQL.Client.Serializer.Tests.csproj index edf3881f..b0efc377 100644 --- a/tests/GraphQL.Client.Serializer.Tests/GraphQL.Client.Serializer.Tests.csproj +++ b/tests/GraphQL.Client.Serializer.Tests/GraphQL.Client.Serializer.Tests.csproj @@ -7,8 +7,8 @@ - - + + @@ -20,9 +20,13 @@ - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/GraphQL.Client.Tests.Common/GraphQL.Client.Tests.Common.csproj b/tests/GraphQL.Client.Tests.Common/GraphQL.Client.Tests.Common.csproj index f199b89a..6b76cf7d 100644 --- a/tests/GraphQL.Client.Tests.Common/GraphQL.Client.Tests.Common.csproj +++ b/tests/GraphQL.Client.Tests.Common/GraphQL.Client.Tests.Common.csproj @@ -7,7 +7,7 @@ - + diff --git a/tests/GraphQL.Client.Tests.Common/StarWars/Types/DroidType.cs b/tests/GraphQL.Client.Tests.Common/StarWars/Types/DroidType.cs index 72680c43..661737f6 100644 --- a/tests/GraphQL.Client.Tests.Common/StarWars/Types/DroidType.cs +++ b/tests/GraphQL.Client.Tests.Common/StarWars/Types/DroidType.cs @@ -15,8 +15,7 @@ public DroidType(StarWarsData data) Field>("friends").Resolve(context => data.GetFriends(context.Source)); - Connection() - .Name("friendsConnection") + Connection("friendsConnection") .Description("A list of a character's friends.") .Bidirectional() .Resolve(context => context.GetPagedResults(data, context.Source.Friends)); diff --git a/tests/GraphQL.Client.Tests.Common/StarWars/Types/HumanType.cs b/tests/GraphQL.Client.Tests.Common/StarWars/Types/HumanType.cs index a95e01d0..ed19cf5c 100644 --- a/tests/GraphQL.Client.Tests.Common/StarWars/Types/HumanType.cs +++ b/tests/GraphQL.Client.Tests.Common/StarWars/Types/HumanType.cs @@ -14,8 +14,7 @@ public HumanType(StarWarsData data) Field>("friends").Resolve(context => data.GetFriends(context.Source)); - Connection() - .Name("friendsConnection") + Connection("friendsConnection") .Description("A list of a character's friends.") .Bidirectional() .Resolve(context => context.GetPagedResults(data, context.Source.Friends)); diff --git a/tests/GraphQL.Integration.Tests/GraphQL.Integration.Tests.csproj b/tests/GraphQL.Integration.Tests/GraphQL.Integration.Tests.csproj index bb5b4616..4a3f7dc2 100644 --- a/tests/GraphQL.Integration.Tests/GraphQL.Integration.Tests.csproj +++ b/tests/GraphQL.Integration.Tests/GraphQL.Integration.Tests.csproj @@ -7,7 +7,7 @@ - + @@ -19,9 +19,13 @@ - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/GraphQL.Primitives.Tests/GraphQL.Primitives.Tests.csproj b/tests/GraphQL.Primitives.Tests/GraphQL.Primitives.Tests.csproj index ffe7c0a6..d17dbc94 100644 --- a/tests/GraphQL.Primitives.Tests/GraphQL.Primitives.Tests.csproj +++ b/tests/GraphQL.Primitives.Tests/GraphQL.Primitives.Tests.csproj @@ -11,9 +11,13 @@ - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/tests/GraphQL.Server.Test/GraphQL.Server.Test.csproj b/tests/GraphQL.Server.Test/GraphQL.Server.Test.csproj index 00d8126c..191bfd81 100644 --- a/tests/GraphQL.Server.Test/GraphQL.Server.Test.csproj +++ b/tests/GraphQL.Server.Test/GraphQL.Server.Test.csproj @@ -6,9 +6,9 @@ - - - + + + diff --git a/tests/IntegrationTestServer/IntegrationTestServer.csproj b/tests/IntegrationTestServer/IntegrationTestServer.csproj index 66d8071d..58854750 100644 --- a/tests/IntegrationTestServer/IntegrationTestServer.csproj +++ b/tests/IntegrationTestServer/IntegrationTestServer.csproj @@ -11,7 +11,7 @@ - +