Skip to content

Commit 592db06

Browse files
authored
Merge pull request #169 from graphql-dotnet/develop
Release 2.1
2 parents f5a5b1e + 0e9456d commit 592db06

File tree

92 files changed

+2292
-918
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+2292
-918
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Branch workflow (Ubuntu)
2+
on:
3+
push:
4+
branches-ignore:
5+
- develop
6+
- 'release/**'
7+
- 'releases/**'
8+
env:
9+
DOTNET_CLI_TELEMETRY_OPTOUT: true
10+
jobs:
11+
generateVersionInfo:
12+
name: GenerateVersionInfo
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- name: Restore dotnet tools
20+
run: dotnet tool restore
21+
- name: Fetch complete repository
22+
run: git fetch
23+
- name: Generate version info from git history
24+
run: dotnet gitversion /output json > gitversion.json
25+
- name: Upload version info file
26+
uses: actions/upload-artifact@v1
27+
with:
28+
name: gitversion
29+
path: gitversion.json
30+
31+
build:
32+
name: Build
33+
needs: generateVersionInfo
34+
runs-on: ubuntu-latest
35+
steps:
36+
- name: Checkout
37+
uses: actions/checkout@v2
38+
- name: Download version info file
39+
uses: actions/download-artifact@v1
40+
with:
41+
name: gitversion
42+
path: ./
43+
- name: Inject version info into environment
44+
run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json
45+
- name: Build solution
46+
run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet build -c Release
47+
- name: Create NuGet packages
48+
run: dotnet pack -c Release --no-build -o nupkg
49+
- name: Upload nuget packages
50+
uses: actions/upload-artifact@v1
51+
with:
52+
name: nupkg
53+
path: nupkg
54+
55+
test:
56+
name: Test
57+
needs: [build, generateVersionInfo]
58+
runs-on: ubuntu-latest
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v2
62+
- name: Download version info file
63+
uses: actions/download-artifact@v1
64+
with:
65+
name: gitversion
66+
path: ./
67+
- name: Inject version info into environment
68+
run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json
69+
- name: Run tests
70+
run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet test -c Release

.github/workflows/branches.yml renamed to .github/workflows/branches-windows.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Branch workflow
2-
on:
2+
on:
33
push:
44
branches-ignore:
5-
- develop
6-
- 'release/**'
7-
- 'releases/**'
5+
- '**'
86
jobs:
97
generateVersionInfo:
108
name: GenerateVersionInfo

.github/workflows/main-ubuntu.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Main workflow (Ubuntu)
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
- 'release/**'
7+
- 'releases/**'
8+
tags:
9+
- v*
10+
- V*
11+
env:
12+
DOTNET_CLI_TELEMETRY_OPTOUT: true
13+
jobs:
14+
generateVersionInfo:
15+
name: GenerateVersionInfo
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
22+
- name: Restore dotnet tools
23+
run: dotnet tool restore
24+
- name: Fetch complete repository
25+
run: git fetch
26+
- name: Generate version info from git history
27+
run: dotnet gitversion /output json > gitversion.json
28+
- name: Upload version info file
29+
uses: actions/upload-artifact@v1
30+
with:
31+
name: gitversion
32+
path: gitversion.json
33+
34+
build:
35+
name: Build
36+
needs: generateVersionInfo
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v2
41+
- name: Download version info file
42+
uses: actions/download-artifact@v1
43+
with:
44+
name: gitversion
45+
path: ./
46+
- name: Inject version info into environment
47+
run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json
48+
- name: Build solution
49+
run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet build -c Release
50+
- name: Create NuGet packages
51+
run: dotnet pack -c Release --no-build -o nupkg
52+
- name: Upload nuget packages
53+
uses: actions/upload-artifact@v1
54+
with:
55+
name: nupkg
56+
path: nupkg
57+
58+
test:
59+
name: Test
60+
needs: [build, generateVersionInfo]
61+
runs-on: ubuntu-latest
62+
steps:
63+
- name: Checkout
64+
uses: actions/checkout@v2
65+
- name: Download version info file
66+
uses: actions/download-artifact@v1
67+
with:
68+
name: gitversion
69+
path: ./
70+
- name: Inject version info into environment
71+
run: jq -r 'to_entries|map("::set-env name=GitVersion_\(.key)::\(.value|tostring)")|.[]' gitversion.json
72+
- name: Run tests
73+
run: echo "Current version is \"$GitVersion_SemVer\"" && dotnet test -c Release
74+
75+
publish:
76+
name: Publish
77+
needs: [test]
78+
runs-on: ubuntu-latest
79+
steps:
80+
- name: Checkout
81+
uses: actions/checkout@v2
82+
- name: Download nuget packages
83+
uses: actions/download-artifact@v1
84+
with:
85+
name: nupkg
86+
- name: Publish the package to GPR
87+
# using workaround with CURL because of non-functioning upload via dotnet nuget (https://stackoverflow.com/a/58943251)
88+
run: |
89+
for f in ./nupkg/*.nupkg
90+
do
91+
curl -vX PUT -u "graphql-dotnet:${{secrets.GITHUB_TOKEN}}" -F package=@$f https://nuget.pkg.github.com/graphql-dotnet/
92+
done

.github/workflows/main.yml renamed to .github/workflows/main-windows.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,8 @@
11
name: Main workflow
2-
on:
2+
on:
33
push:
4-
branches:
5-
- develop
6-
- 'release/**'
7-
- 'releases/**'
8-
tags:
9-
- v*
10-
- V*
4+
branches-ignore:
5+
- '**'
116
jobs:
127
generateVersionInfo:
138
name: GenerateVersionInfo

GitVersion.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
branches:
2-
release:
3-
mode: ContinuousDeployment
1+
mode: ContinuousDeployment

GraphQL.Client.sln

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,10 @@ EndProject
3232
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Server.Test", "tests\GraphQL.Server.Test\GraphQL.Server.Test.csproj", "{E95A1258-F666-4D4E-9101-E0C46F6A3CB3}"
3333
EndProject
3434
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{C42106CF-F685-4F29-BC18-A70616BD68A0}"
35-
ProjectSection(SolutionItems) = preProject
36-
.github\FUNDING.yml = .github\FUNDING.yml
37-
EndProjectSection
3835
EndProject
3936
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{05CAF9B2-981E-40C0-AE31-5FA56E351F12}"
4037
ProjectSection(SolutionItems) = preProject
38+
.github\workflows\branches-ubuntu.yml = .github\workflows\branches-ubuntu.yml
4139
.github\workflows\branches.yml = .github\workflows\branches.yml
4240
.github\workflows\main.yml = .github\workflows\main.yml
4341
EndProjectSection
@@ -58,6 +56,18 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Abstractions
5856
EndProject
5957
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client", "src\GraphQL.Client\GraphQL.Client.csproj", "{ED3541C9-D2B2-4D06-A464-38E404A3919A}"
6058
EndProject
59+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Abstractions.Websocket", "src\GraphQL.Client.Abstractions.Websocket\GraphQL.Client.Abstractions.Websocket.csproj", "{4D581CE1-523D-46BF-BAA5-F7D79A1B7654}"
60+
EndProject
61+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Serializer.Newtonsoft", "src\GraphQL.Client.Serializer.Newtonsoft\GraphQL.Client.Serializer.Newtonsoft.csproj", "{11F28E78-ADE4-4153-B97C-56136EB7BD5B}"
62+
EndProject
63+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.LocalExecution", "src\GraphQL.Client.LocalExecution\GraphQL.Client.LocalExecution.csproj", "{2BEC821C-E405-43CB-9BC9-A6BB0322F6C2}"
64+
EndProject
65+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Serializer.Tests", "tests\GraphQL.Client.Serializer.Tests\GraphQL.Client.Serializer.Tests.csproj", "{CA842D18-FC4A-4281-B1FF-080FA91887B8}"
66+
EndProject
67+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Tests.Common", "tests\GraphQL.Client.Tests.Common\GraphQL.Client.Tests.Common.csproj", "{0D307BAD-27AE-4A5D-8764-4AA2620B01E9}"
68+
EndProject
69+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GraphQL.Client.Serializer.SystemTextJson", "src\GraphQL.Client.Serializer.SystemTextJson\GraphQL.Client.Serializer.SystemTextJson.csproj", "{7FFFEC00-D751-4FFC-9FD4-E91858F9A1C5}"
70+
EndProject
6171
Global
6272
GlobalSection(SolutionConfigurationPlatforms) = preSolution
6373
Debug|Any CPU = Debug|Any CPU
@@ -96,19 +106,50 @@ Global
96106
{ED3541C9-D2B2-4D06-A464-38E404A3919A}.Debug|Any CPU.Build.0 = Debug|Any CPU
97107
{ED3541C9-D2B2-4D06-A464-38E404A3919A}.Release|Any CPU.ActiveCfg = Release|Any CPU
98108
{ED3541C9-D2B2-4D06-A464-38E404A3919A}.Release|Any CPU.Build.0 = Release|Any CPU
109+
{4D581CE1-523D-46BF-BAA5-F7D79A1B7654}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
110+
{4D581CE1-523D-46BF-BAA5-F7D79A1B7654}.Debug|Any CPU.Build.0 = Debug|Any CPU
111+
{4D581CE1-523D-46BF-BAA5-F7D79A1B7654}.Release|Any CPU.ActiveCfg = Release|Any CPU
112+
{4D581CE1-523D-46BF-BAA5-F7D79A1B7654}.Release|Any CPU.Build.0 = Release|Any CPU
113+
{11F28E78-ADE4-4153-B97C-56136EB7BD5B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
114+
{11F28E78-ADE4-4153-B97C-56136EB7BD5B}.Debug|Any CPU.Build.0 = Debug|Any CPU
115+
{11F28E78-ADE4-4153-B97C-56136EB7BD5B}.Release|Any CPU.ActiveCfg = Release|Any CPU
116+
{11F28E78-ADE4-4153-B97C-56136EB7BD5B}.Release|Any CPU.Build.0 = Release|Any CPU
117+
{2BEC821C-E405-43CB-9BC9-A6BB0322F6C2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
118+
{2BEC821C-E405-43CB-9BC9-A6BB0322F6C2}.Debug|Any CPU.Build.0 = Debug|Any CPU
119+
{2BEC821C-E405-43CB-9BC9-A6BB0322F6C2}.Release|Any CPU.ActiveCfg = Release|Any CPU
120+
{2BEC821C-E405-43CB-9BC9-A6BB0322F6C2}.Release|Any CPU.Build.0 = Release|Any CPU
121+
{CA842D18-FC4A-4281-B1FF-080FA91887B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
122+
{CA842D18-FC4A-4281-B1FF-080FA91887B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
123+
{CA842D18-FC4A-4281-B1FF-080FA91887B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
124+
{CA842D18-FC4A-4281-B1FF-080FA91887B8}.Release|Any CPU.Build.0 = Release|Any CPU
125+
{0D307BAD-27AE-4A5D-8764-4AA2620B01E9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
126+
{0D307BAD-27AE-4A5D-8764-4AA2620B01E9}.Debug|Any CPU.Build.0 = Debug|Any CPU
127+
{0D307BAD-27AE-4A5D-8764-4AA2620B01E9}.Release|Any CPU.ActiveCfg = Release|Any CPU
128+
{0D307BAD-27AE-4A5D-8764-4AA2620B01E9}.Release|Any CPU.Build.0 = Release|Any CPU
129+
{7FFFEC00-D751-4FFC-9FD4-E91858F9A1C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
130+
{7FFFEC00-D751-4FFC-9FD4-E91858F9A1C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
131+
{7FFFEC00-D751-4FFC-9FD4-E91858F9A1C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
132+
{7FFFEC00-D751-4FFC-9FD4-E91858F9A1C5}.Release|Any CPU.Build.0 = Release|Any CPU
99133
EndGlobalSection
100134
GlobalSection(SolutionProperties) = preSolution
101135
HideSolutionNode = FALSE
102136
EndGlobalSection
103137
GlobalSection(NestedProjects) = preSolution
104138
{E95A1258-F666-4D4E-9101-E0C46F6A3CB3} = {0B0EDB0F-FF67-4B78-A8DB-B5C23E1FEE8C}
139+
{05CAF9B2-981E-40C0-AE31-5FA56E351F12} = {C42106CF-F685-4F29-BC18-A70616BD68A0}
105140
{95D78D57-3232-491D-BAD6-F373D76EA34D} = {D61415CA-D822-43DD-9AE7-993B8B60E855}
106141
{87FC440E-6A4D-47D8-9EB2-416FC31CC4A6} = {47C98B55-08F1-4428-863E-2C5C876DEEFE}
107142
{C212983F-67DB-44EB-BFB0-5DA75A86DF55} = {0B0EDB0F-FF67-4B78-A8DB-B5C23E1FEE8C}
108143
{92107DF5-73DF-4371-8EB1-6734FED704AD} = {0B0EDB0F-FF67-4B78-A8DB-B5C23E1FEE8C}
109144
{C68C26EB-7659-402A-93D1-E6E248DA5427} = {0B0EDB0F-FF67-4B78-A8DB-B5C23E1FEE8C}
110145
{76E622F6-7CDD-4B1F-AD06-FFABF37C55E5} = {47C98B55-08F1-4428-863E-2C5C876DEEFE}
111146
{ED3541C9-D2B2-4D06-A464-38E404A3919A} = {47C98B55-08F1-4428-863E-2C5C876DEEFE}
147+
{4D581CE1-523D-46BF-BAA5-F7D79A1B7654} = {47C98B55-08F1-4428-863E-2C5C876DEEFE}
148+
{11F28E78-ADE4-4153-B97C-56136EB7BD5B} = {47C98B55-08F1-4428-863E-2C5C876DEEFE}
149+
{2BEC821C-E405-43CB-9BC9-A6BB0322F6C2} = {47C98B55-08F1-4428-863E-2C5C876DEEFE}
150+
{CA842D18-FC4A-4281-B1FF-080FA91887B8} = {0B0EDB0F-FF67-4B78-A8DB-B5C23E1FEE8C}
151+
{0D307BAD-27AE-4A5D-8764-4AA2620B01E9} = {0B0EDB0F-FF67-4B78-A8DB-B5C23E1FEE8C}
152+
{7FFFEC00-D751-4FFC-9FD4-E91858F9A1C5} = {47C98B55-08F1-4428-863E-2C5C876DEEFE}
112153
EndGlobalSection
113154
GlobalSection(ExtensibilityGlobals) = postSolution
114155
SolutionGuid = {387AC1AC-F90C-4EF8-955A-04D495C75AF4}

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,11 @@ var heroAndFriendsRequest = new GraphQLRequest {
4343
};
4444
```
4545

46+
Be careful when using `byte[]` in your variables object, as most JSON serializers will treat that as binary data! If you really need to send a *list of bytes* with a `byte[]` as a source, then convert it to a `List<byte>` first, which will tell the serializer to output a list of numbers instead of a base64-encoded string.
47+
4648
### Execute Query/Mutation:
4749
```csharp
48-
var graphQLClient = new GraphQLClient("https://swapi.apis.guru/");
50+
var graphQLClient = new GraphQLHttpClient("https://swapi.apis.guru/");
4951

5052
public class HeroAndFriendsResponse {
5153
public Hero Hero {get; set;}
@@ -62,6 +64,8 @@ var graphQLResponse = await graphQLClient.SendQueryAsync<HeroAndFriendsResponse>
6264
var heroName = graphQLResponse.Data.Hero.Name;
6365
```
6466

67+
68+
6569
### Use Subscriptions
6670

6771
```csharp
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<Import Project="../src.props" />
3+
4+
<PropertyGroup>
5+
<TargetFramework>netstandard2.0</TargetFramework>
6+
<LangVersion>8.0</LangVersion>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ProjectReference Include="..\GraphQL.Client.Abstractions\GraphQL.Client.Abstractions.csproj" />
11+
</ItemGroup>
12+
13+
</Project>

src/GraphQL.Client/Websocket/GraphQLWebSocketMessageType.cs renamed to src/GraphQL.Client.Abstractions.Websocket/GraphQLWebSocketMessageType.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace GraphQL.Client.Http.Websocket {
1+
namespace GraphQL.Client.Abstractions.Websocket {
22
public static class GraphQLWebSocketMessageType {
33

44
/// <summary>

src/GraphQL.Client/Websocket/GraphQLWebSocketRequest.cs renamed to src/GraphQL.Client.Abstractions.Websocket/GraphQLWebSocketRequest.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Runtime.Serialization;
34
using System.Threading.Tasks;
45

5-
namespace GraphQL.Client.Http.Websocket {
6+
namespace GraphQL.Client.Abstractions.Websocket {
67

78
/// <summary>
89
/// A Subscription Request
910
/// </summary>
1011
public class GraphQLWebSocketRequest : IEquatable<GraphQLWebSocketRequest> {
12+
public const string IdKey = "id";
13+
public const string TypeKey = "type";
14+
public const string PayloadKey = "payload";
1115

1216
/// <summary>
1317
/// The Identifier of the Response
1418
/// </summary>
15-
public string Id { get; set; }
19+
[DataMember(Name = IdKey)]
20+
public virtual string Id { get; set; }
1621

1722
/// <summary>
1823
/// The Type of the Request
1924
/// </summary>
20-
public string Type { get; set; }
25+
[DataMember(Name = TypeKey)]
26+
public virtual string Type { get; set; }
2127

2228
/// <summary>
2329
/// The payload of the websocket request
2430
/// </summary>
25-
public GraphQLRequest Payload { get; set; }
31+
[DataMember(Name = PayloadKey)]
32+
public virtual GraphQLRequest Payload { get; set; }
2633

2734
private TaskCompletionSource<bool> _tcs = new TaskCompletionSource<bool>();
2835

0 commit comments

Comments
 (0)