diff --git a/src/WireMock.Net.Abstractions/WireMock.Net.Abstractions.csproj b/src/WireMock.Net.Abstractions/WireMock.Net.Abstractions.csproj
index 32fa99b03..9cf9ca4f6 100644
--- a/src/WireMock.Net.Abstractions/WireMock.Net.Abstractions.csproj
+++ b/src/WireMock.Net.Abstractions/WireMock.Net.Abstractions.csproj
@@ -31,7 +31,7 @@
- $(DefineConstants);GRAPHQL;MIMEKIT;PROTOBUF
+ $(DefineConstants);MIMEKIT;PROTOBUF
diff --git a/src/WireMock.Net.GraphQL/Matchers/Request/RequestMessageGraphQLMatcher.cs b/src/WireMock.Net.GraphQL/Matchers/Request/RequestMessageGraphQLMatcher.cs
index b554e05ee..ec7877451 100644
--- a/src/WireMock.Net.GraphQL/Matchers/Request/RequestMessageGraphQLMatcher.cs
+++ b/src/WireMock.Net.GraphQL/Matchers/Request/RequestMessageGraphQLMatcher.cs
@@ -86,15 +86,8 @@ private IReadOnlyList CalculateMatchResults(IRequestMessage request
return Matchers == null ? new[] { new MatchResult() } : Matchers.Select(matcher => CalculateMatchResult(requestMessage, matcher)).ToArray();
}
- //#if GRAPHQL
private static IMatcher[] CreateMatcherArray(MatchBehaviour matchBehaviour, AnyOfTypes.AnyOf schema, IDictionary? customScalars)
{
return new[] { TypeLoader.Load(schema, customScalars, matchBehaviour, MatchOperator.Or) }.Cast().ToArray();
}
- //#else
- // private static IMatcher[] CreateMatcherArray(MatchBehaviour matchBehaviour, object schema, IDictionary? customScalars)
- // {
- // throw new System.NotSupportedException("The GrapQLMatcher can not be used for .NETStandard1.3 or .NET Framework 4.6.1 or lower.");
- // }
- //#endif
}
\ No newline at end of file
diff --git a/src/WireMock.Net.GraphQL/RequestBuilders/IRequestBuilderExtensions.cs b/src/WireMock.Net.GraphQL/RequestBuilders/IRequestBuilderExtensions.cs
index e7cdaa805..76b6a6f29 100644
--- a/src/WireMock.Net.GraphQL/RequestBuilders/IRequestBuilderExtensions.cs
+++ b/src/WireMock.Net.GraphQL/RequestBuilders/IRequestBuilderExtensions.cs
@@ -1,6 +1,7 @@
// ReSharper disable InconsistentNaming
using System;
using System.Collections.Generic;
+using Stef.Validation;
using WireMock.Matchers;
using WireMock.Matchers.Request;
@@ -14,6 +15,7 @@ public static class IRequestBuilderExtensions
///
/// WithGraphQLSchema: The GraphQL schema as a string.
///
+ /// The .
/// The GraphQL schema.
/// The match behaviour. (Default is MatchBehaviour.AcceptOnMatch).
/// The .
@@ -25,6 +27,7 @@ public static IRequestBuilder WithGraphQLSchema(this IRequestBuilder requestBuil
///
/// WithGraphQLSchema: The GraphQL schema as a string.
///
+ /// The .
/// The GraphQL schema.
/// A dictionary defining the custom scalars used in this schema. (optional)
/// The match behaviour. (Default is MatchBehaviour.AcceptOnMatch).
@@ -37,29 +40,32 @@ public static IRequestBuilder WithGraphQLSchema(this IRequestBuilder requestBuil
///
/// WithBodyAsGraphQL: The GraphQL schema as a string.
///
+ /// The .
/// The GraphQL schema.
/// The match behaviour. (Default is MatchBehaviour.AcceptOnMatch).
/// The .
public static IRequestBuilder WithBodyAsGraphQL(this IRequestBuilder requestBuilder, string schema, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
{
- return requestBuilder.Add(new RequestMessageGraphQLMatcher(matchBehaviour, schema));
+ return Guard.NotNull(requestBuilder).Add(new RequestMessageGraphQLMatcher(matchBehaviour, schema));
}
///
/// WithBodyAsGraphQL: The GraphQL schema as a string.
///
+ /// The .
/// The GraphQL schema.
/// A dictionary defining the custom scalars used in this schema. (optional)
/// The match behaviour. (Default is MatchBehaviour.AcceptOnMatch).
/// The .
public static IRequestBuilder WithBodyAsGraphQL(this IRequestBuilder requestBuilder, string schema, IDictionary? customScalars, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
{
- return requestBuilder.Add(new RequestMessageGraphQLMatcher(matchBehaviour, schema, customScalars));
+ return Guard.NotNull(requestBuilder).Add(new RequestMessageGraphQLMatcher(matchBehaviour, schema, customScalars));
}
///
/// WithGraphQLSchema: The GraphQL schema as a ISchema.
///
+ /// The .
/// The GraphQL schema.
/// The match behaviour. (Default is MatchBehaviour.AcceptOnMatch).
/// The .
@@ -71,6 +77,7 @@ public static IRequestBuilder WithGraphQLSchema(this IRequestBuilder requestBuil
///
/// WithGraphQLSchema: The GraphQL schema as a ISchema.
///
+ /// The .
/// The GraphQL schema.
/// A dictionary defining the custom scalars used in this schema. (optional)
/// The match behaviour. (Default is MatchBehaviour.AcceptOnMatch).
@@ -83,6 +90,7 @@ public static IRequestBuilder WithGraphQLSchema(this IRequestBuilder requestBuil
///
/// WithBodyAsGraphQL: The GraphQL schema as a ISchema.
///
+ /// The .
/// The GraphQL schema.
/// The match behaviour. (Default is MatchBehaviour.AcceptOnMatch).
/// The .
@@ -94,18 +102,20 @@ public static IRequestBuilder WithBodyAsGraphQL(this IRequestBuilder requestBuil
///
/// WithBodyAsGraphQL: The GraphQL schema as a ISchema.
///
+ /// The .
/// The GraphQL schema.
/// A dictionary defining the custom scalars used in this schema. (optional)
/// The match behaviour. (Default is MatchBehaviour.AcceptOnMatch).
/// The .
public static IRequestBuilder WithBodyAsGraphQL(this IRequestBuilder requestBuilder, GraphQL.Types.ISchema schema, IDictionary? customScalars, MatchBehaviour matchBehaviour = MatchBehaviour.AcceptOnMatch)
{
- return requestBuilder.Add(new RequestMessageGraphQLMatcher(matchBehaviour, schema, customScalars));
+ return Guard.NotNull(requestBuilder).Add(new RequestMessageGraphQLMatcher(matchBehaviour, schema, customScalars));
}
///
/// WithBodyAsGraphQLSchema: Body as GraphQL schema as a string.
///
+ /// The .
/// The GraphQL schema.
/// The match behaviour. (Default is MatchBehaviour.AcceptOnMatch).
/// The .
diff --git a/src/WireMock.Net.GraphQL/WireMock.Net.GraphQL.csproj b/src/WireMock.Net.GraphQL/WireMock.Net.GraphQL.csproj
index 5979721f3..4f6a77784 100644
--- a/src/WireMock.Net.GraphQL/WireMock.Net.GraphQL.csproj
+++ b/src/WireMock.Net.GraphQL/WireMock.Net.GraphQL.csproj
@@ -26,10 +26,6 @@
true
-
-
diff --git a/src/WireMock.Net/Serialization/MatcherMapper.cs b/src/WireMock.Net/Serialization/MatcherMapper.cs
index b7d04f229..7698fa728 100644
--- a/src/WireMock.Net/Serialization/MatcherMapper.cs
+++ b/src/WireMock.Net/Serialization/MatcherMapper.cs
@@ -163,11 +163,10 @@ public MatcherMapper(WireMockServerSettings settings)
case XPathMatcher xpathMatcher:
model.XmlNamespaceMap = xpathMatcher.XmlNamespaceMap;
break;
-#if GRAPHQL
+
case IGraphQLMatcher graphQLMatcher:
model.CustomScalars = graphQLMatcher.CustomScalars;
break;
-#endif
}
switch (matcher)
diff --git a/src/WireMock.Net/WireMock.Net.csproj b/src/WireMock.Net/WireMock.Net.csproj
index bbbf9a64c..f0e59c832 100644
--- a/src/WireMock.Net/WireMock.Net.csproj
+++ b/src/WireMock.Net/WireMock.Net.csproj
@@ -51,7 +51,7 @@
- $(DefineConstants);GRAPHQL;MIMEKIT;PROTOBUF
+ $(DefineConstants);MIMEKIT;PROTOBUF