diff --git a/Directory.Packages.props b/Directory.Packages.props
index dc1e67d26..5904ecbb2 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -1,132 +1,132 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/Graphql/Conventions/GraphqlConvention.cs b/src/Graphql/Conventions/GraphqlConvention.cs
index 6ded84b46..a953d45f1 100644
--- a/src/Graphql/Conventions/GraphqlConvention.cs
+++ b/src/Graphql/Conventions/GraphqlConvention.cs
@@ -16,6 +16,13 @@ namespace Rocket.Surgery.LaunchPad.Graphql.Conventions
{
public class GraphqlConvention : IServiceConvention
{
+ private readonly IFairyBreadOptions _options;
+
+ public GraphqlConvention(IFairyBreadOptions? options = null)
+ {
+ _options = options ?? new DefaultFairyBreadOptions();
+ }
+
public void Register(IConventionContext context, IConfiguration configuration, IServiceCollection services)
{
var types = context.AssemblyCandidateFinder.GetCandidateAssemblies("MediatR")
@@ -25,8 +32,8 @@ public void Register(IConventionContext context, IConfiguration configuration, I
.ToArray();
services.TryAddSingleton();
- services.TryAddSingleton();
- services.TryAddSingleton(new DefaultFairyBreadOptions());
+ services.TryAddSingleton();
+ services.TryAddSingleton(_options);
services.TryAddEnumerable(ServiceDescriptor.Singleton(new AutoConfigureMediatRMutation(types)));
var sb = services
diff --git a/src/Graphql/CustomInputValidationMiddleware.cs b/src/Graphql/CustomInputValidationMiddleware.cs
index de0fc02bb..9c2791e6d 100644
--- a/src/Graphql/CustomInputValidationMiddleware.cs
+++ b/src/Graphql/CustomInputValidationMiddleware.cs
@@ -16,26 +16,27 @@ class CustomInputValidationMiddleware
private readonly FieldDelegate _next;
private readonly IFairyBreadOptions _options;
private readonly IValidatorProvider _validatorProvider;
- private readonly IValidationResultHandler _validationResultHandler;
+ private readonly IValidationErrorsHandler _validationErrorsHandler;
public CustomInputValidationMiddleware(
FieldDelegate next,
IFairyBreadOptions options,
IValidatorProvider validatorProvider,
- IValidationResultHandler validationResultHandler
+ IValidationErrorsHandler validationErrorsHandler
)
{
_next = next;
_options = options;
_validatorProvider = validatorProvider;
- _validationResultHandler = validationResultHandler;
+ _validationErrorsHandler = validationErrorsHandler;
}
+
public async Task InvokeAsync(IMiddlewareContext context)
{
var arguments = context.Field.Arguments;
- var validationResults = new List();
+ var invalidResults = new List();
foreach (var argument in arguments)
{
@@ -45,19 +46,27 @@ public async Task InvokeAsync(IMiddlewareContext context)
continue;
}
- var resolvedValidators = _validatorProvider.GetValidators(context, argument).ToArray();
+ var resolvedValidators = _validatorProvider.GetValidators(context, argument);
try
{
- var value = context.ArgumentValue