Skip to content

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sahb1239 committed May 17, 2020
2 parents d2e2b96 + 3d85b6d commit 75a34ba
Show file tree
Hide file tree
Showing 26 changed files with 157 additions and 45 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/dotnetcore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: .NET Core

on:
push:
branches: [ master, develop ]
pull_request:
branches: [ master, develop ]

jobs:
build:

runs-on: [windows-latest]

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.101
- name: Restore tools
run: dotnet tool restore
- name: Build
run: dotnet build --configuration Release
12 changes: 6 additions & 6 deletions SAHB.GraphQL.Client.sln
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
src\Common.props = src\Common.props
Documentation.md = Documentation.md
Examples.md = Examples.md
LICENSE = LICENSE
README.md = README.md
EndProjectSection
EndProject
Expand All @@ -31,9 +32,12 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{57
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAHB.GraphQL.Client.Subscription.Integration.Tests", "tests\SAHB.GraphQL.Client.Subscription.Integration.Tests\SAHB.GraphQL.Client.Subscription.Integration.Tests.csproj", "{2E930707-9DFB-425D-9D4D-AC0A682C3881}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SAHB.GraphQL.Client.Testserver", "tests\SAHB.GraphQL.Client.Testserver\SAHB.GraphQL.Client.Testserver.csproj", "{37969D10-CEF6-40A5-BA56-D24CE251B94B}"
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "TestServer", "tests\TestServer\TestServer.shproj", "{15808CC4-3BCF-46B2-9F16-B5251433AC6C}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
tests\TestServer\TestServer.projitems*{15808cc4-3bcf-46b2-9f16-b5251433ac6c}*SharedItemsImports = 13
EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Expand Down Expand Up @@ -71,10 +75,6 @@ Global
{2E930707-9DFB-425D-9D4D-AC0A682C3881}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2E930707-9DFB-425D-9D4D-AC0A682C3881}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2E930707-9DFB-425D-9D4D-AC0A682C3881}.Release|Any CPU.Build.0 = Release|Any CPU
{37969D10-CEF6-40A5-BA56-D24CE251B94B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{37969D10-CEF6-40A5-BA56-D24CE251B94B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{37969D10-CEF6-40A5-BA56-D24CE251B94B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{37969D10-CEF6-40A5-BA56-D24CE251B94B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -86,7 +86,7 @@ Global
{08D480C7-E9DE-4E68-B785-41063D854F51} = {57FBCC7E-CBA0-4CF6-BFFE-7BF46849D674}
{F8B79FA0-4C95-4FE1-955B-0DEA9F4CB3F3} = {C954F0A7-3B76-492B-9035-EAFE106C79BD}
{2E930707-9DFB-425D-9D4D-AC0A682C3881} = {C954F0A7-3B76-492B-9035-EAFE106C79BD}
{37969D10-CEF6-40A5-BA56-D24CE251B94B} = {C954F0A7-3B76-492B-9035-EAFE106C79BD}
{15808CC4-3BCF-46B2-9F16-B5251433AC6C} = {C954F0A7-3B76-492B-9035-EAFE106C79BD}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {98F41BED-A49E-419E-9D0E-6291E263386C}
Expand Down
4 changes: 2 additions & 2 deletions src/Common.props
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project>
<Import Project="../Version.props" />
<Import Project="../Version.props" Condition="exists('../Version.props')" />

<PropertyGroup>
<Authors>SAHB</Authors>
<Company>SAHB</Company>
<Description>Query HTTP api using GraphQL with C# defined models.</Description>
<PackageProjectUrl>https://github.com/sahb1239/SAHB.GraphQLClient</PackageProjectUrl>
<PackageLicenseUrl>https://github.com/sahb1239/SAHB.GraphQLClient/blob/master/LICENSE</PackageLicenseUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/sahb1239/SAHB.GraphQLClient</RepositoryUrl>
<PackageTags>graphql object mapper</PackageTags>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,18 @@ public GraphQLSubscriptionClient(WebSocket webSocket, CancellationToken cancella
public bool IsInitilized { get; private set; }

/// <inheritdoc />
public async Task Initilize()
public async Task Initilize(object payload = null)
{
if (!IsConnected)
throw new InvalidOperationException("Connection is not open");

if (payload == null)
payload = new object();
// Sent GQL_CONNECTION_INIT
await SendOperationMessage(new OperationMessage
{
Type = MessageType.GQL_CONNECTION_INIT,
Payload = new object()
Payload = payload
}).ConfigureAwait(false);

// Wait for ack
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public interface IGraphQLSubscriptionClient
/// Initilizes the GraphQL subscription connection
/// </summary>
/// <returns></returns>
Task Initilize();
Task Initilize(object payload = null);

/// <summary>
/// Returns true if the websocket is connected
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
Expand All @@ -7,20 +7,19 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL.Server.Transports.AspNetCore" Version="3.2.0" />
<PackageReference Include="GraphQL.Server.Transports.WebSockets" Version="3.2.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\SAHB.GraphQLClient\SAHB.GraphQL.Client.csproj" />
<ProjectReference Include="..\SAHB.GraphQL.Client.Testserver\SAHB.GraphQL.Client.Testserver.csproj" />
</ItemGroup>

<PropertyGroup>
<PostBuildEvent>
copy /Y "$(SolutionDir)\tests\SAHB.GraphQL.Client.Testserver\bin\$(Configuration)\$(TargetFramework)\SAHB.GraphQL.Client.Testserver.deps.json" $(BaseOutputPath)
</PostBuildEvent>
</PropertyGroup>
<Import Project="..\TestServer\TestServer.projitems" Label="Shared" />

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
Expand All @@ -7,20 +7,20 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GraphQL.Server.Transports.AspNetCore" Version="3.2.0" />
<PackageReference Include="GraphQL.Server.Transports.WebSockets" Version="3.2.0" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.2.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="2.2.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\SAHB.GraphQL.Client.Subscription\SAHB.GraphQL.Client.Subscription.csproj" />
<ProjectReference Include="..\SAHB.GraphQL.Client.Testserver\SAHB.GraphQL.Client.Testserver.csproj" />
<ProjectReference Include="..\..\src\SAHB.GraphQLClient\SAHB.GraphQL.Client.csproj" />
</ItemGroup>

<PropertyGroup>
<PostBuildEvent>
copy /Y "$(SolutionDir)\tests\SAHB.GraphQL.Client.Testserver\bin\$(Configuration)\$(TargetFramework)\SAHB.GraphQL.Client.Testserver.deps.json" $(BaseOutputPath)
</PostBuildEvent>
</PropertyGroup>
<Import Project="..\TestServer\TestServer.projitems" Label="Shared" />

</Project>

This file was deleted.

65 changes: 65 additions & 0 deletions tests/SAHB.GraphQLClient.Tests/Issues/Issue98.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using SAHB.GraphQLClient.FieldBuilder;
using SAHB.GraphQLClient.FieldBuilder.Attributes;
using SAHB.GraphQLClient.QueryGenerator;
using Xunit;

namespace SAHB.GraphQL.Client.Tests.Issues
{
public class Issue98
{
private readonly IGraphQLQueryGeneratorFromFields queryGenerator = new GraphQLQueryGeneratorFromFields();
private readonly IGraphQLFieldBuilder fieldBuilder = new GraphQLFieldBuilder();

[Fact]
public void Generates_Expected_Query()
{
// Arrange
var expectedQuery = "{\"query\":\"query($foo:FooNumber){foobeta(foo:$foo){id}}\",\"variables\":{\"foo\":{\"fooNumber\":\"123456\",\"systemCode\":\"BAZ\"}}}";

// Act
var selectionSet = fieldBuilder.GenerateSelectionSet(typeof(FooQuery));
var actualQuery = queryGenerator.GenerateQuery(
GraphQLOperationType.Query,
selectionSet,
new GraphQLQueryArgument("foo", new FooNumber { Number = "123456", SystemCode = FooSystemType.BAZ }));

// Assert
Assert.Equal(expectedQuery, actualQuery);
}

public class FooNumber
{
[JsonProperty("fooNumber")]
public string Number { get; set; }

[JsonProperty("systemCode")]
public FooSystemType SystemCode { get; set; }
}

public class FooQuery
{
[GraphQLArguments("foo", "FooNumber", "foo")]
public FooBeta FooBeta { get; set; }
}

[GraphQLFieldName("foobeta")]
public class FooBeta : Foo
{
}

public class Foo
{
public string Id { get; set; }
}

[JsonConverter(typeof(StringEnumConverter))]
public enum FooSystemType
{
[EnumMember(Value = "BAZ")]
BAZ,
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
28 changes: 28 additions & 0 deletions tests/TestServer/TestServer.projitems
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>15808cc4-3bcf-46b2-9f16-b5251433ac6c</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>TestServer</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)GraphQLWebApplicationFactory.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\CatOrDog\CatOrDogInterfaceSchema.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\CatOrDog\CatOrDogUnionSchema.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\Chat\ChatSchema.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\Chat\Data\Chat.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\Chat\Data\IChat.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\Chat\Data\Message.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\Chat\Data\MessageFrom.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\Chat\Data\ReceivedMessage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\GenericQuerySchema.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\HelloArgument\HelloArgumentQuerySchema.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\HelloDeprecated\HelloDeprecatedQuerySchema.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\Hello\HelloMutationSchema.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Schemas\Hello\HelloQuerySchema.cs" />
<Compile Include="$(MSBuildThisFileDirectory)TestserverStartup.cs" />
</ItemGroup>
</Project>
13 changes: 13 additions & 0 deletions tests/TestServer/TestServer.shproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>15808cc4-3bcf-46b2-9f16-b5251433ac6c</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="TestServer.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
File renamed without changes.

0 comments on commit 75a34ba

Please sign in to comment.