Use GraphQL 8.2.1 (#1211)

This commit is contained in:
Stef Heyenrath
2024-11-18 10:23:00 +01:00
committed by GitHub
parent f4103b47aa
commit 6f73dfe360
4 changed files with 31 additions and 23 deletions

View File

@@ -113,16 +113,16 @@ public class GraphQLMatcher : IStringMatcher
{ {
try try
{ {
var executionResult = new DocumentExecuter().ExecuteAsync(_ => var executionResult = new DocumentExecuter().ExecuteAsync(eo =>
{ {
_.ThrowOnUnhandledException = true; eo.ThrowOnUnhandledException = true;
_.Schema = _schema; eo.Schema = _schema;
_.Query = graphQLRequest.Query; eo.Query = graphQLRequest.Query;
if (graphQLRequest.Variables != null) if (graphQLRequest.Variables != null)
{ {
_.Variables = new Inputs(graphQLRequest.Variables); eo.Variables = new Inputs(graphQLRequest.Variables);
} }
}).GetAwaiter().GetResult(); }).GetAwaiter().GetResult();

View File

@@ -144,8 +144,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net46' and '$(TargetFramework)' != 'net461'"> <ItemGroup Condition="'$(TargetFramework)' != 'netstandard1.3' and '$(TargetFramework)' != 'net451' and '$(TargetFramework)' != 'net452' and '$(TargetFramework)' != 'net46' and '$(TargetFramework)' != 'net461'">
<PackageReference Include="GraphQL" Version="7.5.0" /> <PackageReference Include="GraphQL.NewtonsoftJson" Version="8.2.1" />
<PackageReference Include="GraphQL.NewtonsoftJson" Version="7.5.0" />
<PackageReference Include="MimeKitLite" Version="4.1.0.1" /> <PackageReference Include="MimeKitLite" Version="4.1.0.1" />
<PackageReference Include="ProtoBufJsonConverter" Version="0.5.0" /> <PackageReference Include="ProtoBufJsonConverter" Version="0.5.0" />
</ItemGroup> </ItemGroup>

View File

@@ -107,22 +107,32 @@ public class GraphQLMatcherTests
public void GraphQLMatcher_For_ValidSchema_And_CorrectGraphQL_UsingCustomType_Mutation_IsMatch() public void GraphQLMatcher_For_ValidSchema_And_CorrectGraphQL_UsingCustomType_Mutation_IsMatch()
{ {
// Arrange // Arrange
const string testSchema = @" // Query is provided here: https://stackoverflow.com/questions/59608833/apollo-graphql-error-query-root-type-must-be-provided
scalar DateTime const string testSchema =
scalar MyCustomScalar """
scalar DateTime
scalar MyCustomScalar
type Query {
_empty: String
}
type Message {
id: ID!
}
type Mutation {
createMessage(x: MyCustomScalar, dt: DateTime): Message
}
""";
type Message { const string input =
id: ID! """
} {
"query": "mutation CreateMessage($x: MyCustomScalar!, $dt: DateTime!) { createMessage(x: $x, dt: $dt) { id } }",
type Mutation { "variables": { "x": 100, "dt": "2007-12-03T10:15:30Z" }
createMessage(x: MyCustomScalar, dt: DateTime): Message }
}"; """;
var input = @"{
""query"": ""mutation CreateMessage($x: MyCustomScalar!, $dt: DateTime!) { createMessage(x: $x, dt: $dt) { id } }"",
""variables"": { ""x"": 100, ""dt"": ""2007-12-03T10:15:30Z"" }
}";
var customScalars = new Dictionary<string, Type> { { "MyCustomScalar", typeof(int) } }; var customScalars = new Dictionary<string, Type> { { "MyCustomScalar", typeof(int) } };

View File

@@ -105,7 +105,6 @@
<ItemGroup Condition="'$(TargetFramework)' != 'net452'"> <ItemGroup Condition="'$(TargetFramework)' != 'net452'">
<PackageReference Include="System.Net.Http.Json" Version="3.2.1" /> <PackageReference Include="System.Net.Http.Json" Version="3.2.1" />
<PackageReference Include="JsonConverter.System.Text.Json" Version="0.7.0" /> <PackageReference Include="JsonConverter.System.Text.Json" Version="0.7.0" />
<PackageReference Include="Google.Protobuf" Version="3.25.1" /> <PackageReference Include="Google.Protobuf" Version="3.25.1" />
<PackageReference Include="Grpc.Net.Client" Version="2.60.0" /> <PackageReference Include="Grpc.Net.Client" Version="2.60.0" />
<PackageReference Include="Grpc.Tools" Version="2.60.0"> <PackageReference Include="Grpc.Tools" Version="2.60.0">