Skip to content

Commit

Permalink
Use GraphQL 8.2.1 (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefH authored Nov 18, 2024
1 parent f4103b4 commit 6f73dfe
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 24 deletions.
10 changes: 5 additions & 5 deletions src/WireMock.Net/Matchers/GraphQLMatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ public MatchResult IsMatch(string? input)
{
try
{
var executionResult = new DocumentExecuter().ExecuteAsync(_ =>
var executionResult = new DocumentExecuter().ExecuteAsync(eo =>
{
_.ThrowOnUnhandledException = true;
eo.ThrowOnUnhandledException = true;

_.Schema = _schema;
_.Query = graphQLRequest.Query;
eo.Schema = _schema;
eo.Query = graphQLRequest.Query;

if (graphQLRequest.Variables != null)
{
_.Variables = new Inputs(graphQLRequest.Variables);
eo.Variables = new Inputs(graphQLRequest.Variables);
}
}).GetAwaiter().GetResult();

Expand Down
3 changes: 1 addition & 2 deletions src/WireMock.Net/WireMock.Net.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@
</ItemGroup>

<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="7.5.0" />
<PackageReference Include="GraphQL.NewtonsoftJson" Version="8.2.1" />
<PackageReference Include="MimeKitLite" Version="4.1.0.1" />
<PackageReference Include="ProtoBufJsonConverter" Version="0.5.0" />
</ItemGroup>
Expand Down
42 changes: 26 additions & 16 deletions test/WireMock.Net.Tests/Matchers/GraphQLMatcherTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -107,22 +107,32 @@ public void GraphQLMatcher_For_ValidSchema_And_CorrectGraphQL_Mutation_IsMatch()
public void GraphQLMatcher_For_ValidSchema_And_CorrectGraphQL_UsingCustomType_Mutation_IsMatch()
{
// Arrange
const string testSchema = @"
scalar DateTime
scalar MyCustomScalar
type Message {
id: ID!
}
type Mutation {
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"" }
}";
// Query is provided here: https://stackoverflow.com/questions/59608833/apollo-graphql-error-query-root-type-must-be-provided
const string testSchema =
"""
scalar DateTime
scalar MyCustomScalar
type Query {
_empty: String
}
type Message {
id: ID!
}
type Mutation {
createMessage(x: MyCustomScalar, dt: DateTime): Message
}
""";

const string 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) } };

Expand Down
1 change: 0 additions & 1 deletion test/WireMock.Net.Tests/WireMock.Net.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
<ItemGroup Condition="'$(TargetFramework)' != 'net452'">
<PackageReference Include="System.Net.Http.Json" Version="3.2.1" />
<PackageReference Include="JsonConverter.System.Text.Json" Version="0.7.0" />

<PackageReference Include="Google.Protobuf" Version="3.25.1" />
<PackageReference Include="Grpc.Net.Client" Version="2.60.0" />
<PackageReference Include="Grpc.Tools" Version="2.60.0">
Expand Down

0 comments on commit 6f73dfe

Please sign in to comment.