1
+ using System . Dynamic ;
1
2
using System . IO . Pipelines ;
2
3
using System . Security . Claims ;
3
4
using Exceptionless . Core . Extensions ;
@@ -32,7 +33,7 @@ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionE
32
33
continue ;
33
34
34
35
// We don't support validating JSON Types
35
- if ( subject is Newtonsoft . Json . Linq . JToken )
36
+ if ( subject is Newtonsoft . Json . Linq . JToken or DynamicObject )
36
37
continue ;
37
38
38
39
( bool isValid , var errors ) = await MiniValidator . TryValidateAsync ( subject , _serviceProvider , recurse : true ) ;
@@ -55,28 +56,28 @@ public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionE
55
56
56
57
if ( hasErrors )
57
58
{
58
- var validationProblem = controllerBase . ProblemDetailsFactory . CreateValidationProblemDetails ( context . HttpContext , context . ModelState , 422 ) ;
59
- context . Result = new UnprocessableEntityObjectResult ( validationProblem ) ;
59
+ var validationProblem = controllerBase . ProblemDetailsFactory . CreateValidationProblemDetails ( context . HttpContext , context . ModelState , 422 ) ;
60
+ context . Result = new UnprocessableEntityObjectResult ( validationProblem ) ;
60
61
61
- return ;
62
- }
62
+ return ;
63
63
}
64
-
65
- await next ( ) ;
66
64
}
67
65
68
- private static bool ShouldValidate ( Type type , IServiceProviderIsService ? isService = null ) =>
69
- ! IsNonValidatedType ( type , isService ) && MiniValidator . RequiresValidation ( type ) ;
66
+ await next ( ) ;
67
+ }
68
+
69
+ private static bool ShouldValidate ( Type type , IServiceProviderIsService ? isService = null ) =>
70
+ ! IsNonValidatedType ( type , isService ) && MiniValidator . RequiresValidation ( type ) ;
70
71
71
- private static bool IsNonValidatedType ( Type type , IServiceProviderIsService ? isService ) =>
72
- typeof ( HttpContext ) == type
73
- || typeof ( HttpRequest ) == type
74
- || typeof ( HttpResponse ) == type
75
- || typeof ( ClaimsPrincipal ) == type
76
- || typeof ( CancellationToken ) == type
77
- || typeof ( IFormFileCollection ) == type
78
- || typeof ( IFormFile ) == type
79
- || typeof ( Stream ) == type
80
- || typeof ( PipeReader ) == type
81
- || isService ? . IsService ( type ) == true ;
72
+ private static bool IsNonValidatedType ( Type type , IServiceProviderIsService ? isService ) =>
73
+ typeof ( HttpContext ) == type
74
+ || typeof ( HttpRequest ) == type
75
+ || typeof ( HttpResponse ) == type
76
+ || typeof ( ClaimsPrincipal ) == type
77
+ || typeof ( CancellationToken ) == type
78
+ || typeof ( IFormFileCollection ) == type
79
+ || typeof ( IFormFile ) == type
80
+ || typeof ( Stream ) == type
81
+ || typeof ( PipeReader ) == type
82
+ || isService ? . IsService ( type ) == true ;
82
83
}
0 commit comments