Skip to content

Commit cac8384

Browse files
authored
74 allow validation of the struct dto or explicitly document unsupported types (#77)
1 parent a4a2a0d commit cac8384

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

FluentValidation.AutoValidation.Mvc/src/Filters/FluentValidationAutoValidationActionFilter.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,7 @@ public async Task OnActionExecutionAsync(ActionExecutingContext actionExecutingC
5858
var hasAutoValidateAlwaysAttribute = parameterInfo?.HasCustomAttribute<AutoValidateAlwaysAttribute>() ?? false;
5959
var hasAutoValidateNeverAttribute = parameterInfo?.HasCustomAttribute<AutoValidateNeverAttribute>() ?? false;
6060

61-
if (subject != null && parameterType != null && parameterType.IsCustomType() &&
62-
!hasAutoValidateNeverAttribute && (hasAutoValidateAlwaysAttribute || HasValidBindingSource(bindingSource)) &&
63-
serviceProvider.GetValidator(parameterType) is IValidator validator)
61+
if (subject != null && parameterType != null && parameterType.IsCustomType() && !hasAutoValidateNeverAttribute && (hasAutoValidateAlwaysAttribute || HasValidBindingSource(bindingSource)) && serviceProvider.GetValidator(parameterType) is IValidator validator)
6462
{
6563
// ReSharper disable once SuspiciousTypeConversion.Global
6664
var validatorInterceptor = validator as IValidatorInterceptor;

0 commit comments

Comments
 (0)