Skip to content

Commit

Permalink
Prepare Release 6.0.4 (#634)
Browse files Browse the repository at this point in the history
* add stringsyntaxattribute to constructor of GraphQLHttpRequest, ad "QL" abbreviation to resharper dictionary

* disable compiler warnings in stub StringSyntaxAttribute for netstandard2.0

* upgrade dependencies

* use dotnet 8.0 for gh workflows
  • Loading branch information
rose-a authored Apr 22, 2024
1 parent 95d3476 commit 79b0161
Show file tree
Hide file tree
Showing 17 changed files with 96 additions and 78 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/branches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Expand Down
1 change: 1 addition & 0 deletions GraphQL.Client.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
2 changes: 2 additions & 0 deletions GraphQL.Client.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=QL/@EntryIndexedValue">QL</s:String></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL.MicrosoftDI" Version="7.6.1" />
<PackageReference Include="GraphQL.MicrosoftDI" Version="7.8.0" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.Text.Json" Version="8.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.3" />
</ItemGroup>

<ItemGroup>
Expand Down
99 changes: 50 additions & 49 deletions src/GraphQL.Client/GraphQLHttpRequest.cs
Original file line number Diff line number Diff line change
@@ -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<string, object?>? extensions = null)
: base(query, variables, operationName, extensions)
{
}

public GraphQLHttpRequest(GraphQLRequest other)
: base(other)
{
}

/// <summary>
/// Creates a <see cref="HttpRequestMessage"/> from this <see cref="GraphQLHttpRequest"/>.
/// Used by <see cref="GraphQLHttpClient"/> to convert GraphQL requests when sending them as regular HTTP requests.
/// </summary>
/// <param name="options">the <see cref="GraphQLHttpClientOptions"/> passed from <see cref="GraphQLHttpClient"/></param>
/// <param name="serializer">the <see cref="IGraphQLJsonSerializer"/> passed from <see cref="GraphQLHttpClient"/></param>
/// <returns></returns>
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<string, object?>? extensions = null)
: base(query, variables, operationName, extensions)
{
}

public GraphQLHttpRequest(GraphQLRequest other)
: base(other)
{
}

/// <summary>
/// Creates a <see cref="HttpRequestMessage"/> from this <see cref="GraphQLHttpRequest"/>.
/// Used by <see cref="GraphQLHttpClient"/> to convert GraphQL requests when sending them as regular HTTP requests.
/// </summary>
/// <param name="options">the <see cref="GraphQLHttpClientOptions"/> passed from <see cref="GraphQLHttpClient"/></param>
/// <param name="serializer">the <see cref="IGraphQLJsonSerializer"/> passed from <see cref="GraphQLHttpClient"/></param>
/// <returns></returns>
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;
}
}
10 changes: 7 additions & 3 deletions src/GraphQL.Primitives/StringSyntaxAttribute.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
#if !NET7_0_OR_GREATER

// ReSharper disable once CheckNamespace
namespace System.Diagnostics.CodeAnalysis;

/// <summary>
/// Stub
/// </summary>
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL.NewtonsoftJson" Version="7.6.1" />
<PackageReference Include="GraphQL.SystemTextJson" Version="7.6.1" />
<PackageReference Include="GraphQL.NewtonsoftJson" Version="7.8.0" />
<PackageReference Include="GraphQL.SystemTextJson" Version="7.8.0" />
</ItemGroup>

<ItemGroup>
Expand All @@ -20,9 +20,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Update="xunit" Version="2.6.2" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.5.4">
<PackageReference Update="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Update="xunit" Version="2.7.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.5.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<PackageReference Include="FluentAssertions.Reactive" Version="0.2.0" />
<PackageReference Include="GraphQL" Version="7.6.1" />
<PackageReference Include="GraphQL" Version="7.8.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ public DroidType(StarWarsData data)

Field<ListGraphType<CharacterInterface>>("friends").Resolve(context => data.GetFriends(context.Source));

Connection<CharacterInterface>()
.Name("friendsConnection")
Connection<CharacterInterface>("friendsConnection")
.Description("A list of a character's friends.")
.Bidirectional()
.Resolve(context => context.GetPagedResults<Droid, StarWarsCharacter>(data, context.Source.Friends));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ public HumanType(StarWarsData data)

Field<ListGraphType<CharacterInterface>>("friends").Resolve(context => data.GetFriends(context.Source));

Connection<CharacterInterface>()
.Name("friendsConnection")
Connection<CharacterInterface>("friendsConnection")
.Description("A list of a character's friends.")
.Bidirectional()
.Resolve(context => context.GetPagedResults<Human, StarWarsCharacter>(data, context.Source.Friends));
Expand Down
12 changes: 8 additions & 4 deletions tests/GraphQL.Integration.Tests/GraphQL.Integration.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.4" />
<PackageReference Include="Microsoft.Reactive.Testing" Version="6.0.0" />
</ItemGroup>

Expand All @@ -19,9 +19,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Update="xunit" Version="2.6.2" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.5.4">
<PackageReference Update="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Update="xunit" Version="2.7.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.5.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
10 changes: 7 additions & 3 deletions tests/GraphQL.Primitives.Tests/GraphQL.Primitives.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Update="xunit" Version="2.6.2" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.5.4">
<PackageReference Update="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageReference Update="xunit" Version="2.7.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.5.8">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
6 changes: 3 additions & 3 deletions tests/GraphQL.Server.Test/GraphQL.Server.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL.MicrosoftDI" Version="7.6.1" />
<PackageReference Include="GraphQL.Server.Transports.AspNetCore" Version="7.6.0" />
<PackageReference Include="GraphQL.Server.Ui.GraphiQL" Version="7.6.0" />
<PackageReference Include="GraphQL.MicrosoftDI" Version="7.8.0" />
<PackageReference Include="GraphQL.Server.Transports.AspNetCore" Version="7.7.1" />
<PackageReference Include="GraphQL.Server.Ui.GraphiQL" Version="7.7.1" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion tests/IntegrationTestServer/IntegrationTestServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GraphQL.Server.All" Version="7.6.0" />
<PackageReference Include="GraphQL.Server.All" Version="7.7.1" />
<PackageReference Include="System.Reactive" Version="6.0.0" />
<PackageReference Include="System.Reactive.Compatibility" Version="6.0.0" />
</ItemGroup>
Expand Down

0 comments on commit 79b0161

Please sign in to comment.