graphql fluent validation implementation with middleware.

This commit is contained in:
David Lebee
2021-02-03 20:28:56 -05:00
parent afb8b534bb
commit ffcfc60df1
19 changed files with 332 additions and 19 deletions
@@ -0,0 +1,10 @@
using System.Collections.Generic;
namespace PoweredSoft.CQRS.GraphQL.Abstractions
{
public interface IGraphQLFieldError
{
string Field { get; set; }
List<string> Errors { get; set; }
}
}
@@ -0,0 +1,11 @@
using System.Collections.Generic;
namespace PoweredSoft.CQRS.GraphQL.Abstractions
{
public interface IGraphQLValidationResult
{
bool IsValid { get; }
List<IGraphQLFieldError> Errors { get; }
}
}
@@ -0,0 +1,13 @@
using System;
using System.Threading;
using System.Threading.Tasks;
namespace PoweredSoft.CQRS.GraphQL.Abstractions
{
public interface IGraphQLValidationService
{
Task<IGraphQLValidationResult> ValidateObjectAsync(object subject, CancellationToken cancellationToken = default);
Task<IGraphQLValidationResult> ValidateAsync<T>(T subject, CancellationToken cancellationToken = default);
}
}
@@ -0,0 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>
</Project>