You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if we could disable validation on specific parameters with the existing [NeverValidate] attribute.
Expected behavior from the existing model validation is to:
Ignore any classes marked with this attribute
Ignore any parameters marked with this attribute
I took a look in the action filter but it appears to be quite difficult to get the attributes of the parameter.
I'd be happy to take a look and implement if there is any interest in this.
The text was updated successfully, but these errors were encountered:
Hi Jon, I think it's possible by casting each parameter variable in the foreach (var parameter in controllerActionDescriptor.Parameters) loop at line 51. Did some quick testing and this seems to work;
var parameterAttributes = ((ControllerParameterDescriptor) parameter).ParameterInfo.CustomAttributes;
The if check needs to be adjusted to check if there is a [ValidateNever] attribute present. Furthermore, a new condition needs to be created to check the presence of that attribute on the method and/or class, I think we can use endpoint.Metadata.OfType<FluentValidationAutoValidationAttribute>().Any() for that purpose.
The only thing I am currently debating is whether the check for the [ValidateNever] attribute always needs to fire or only when the DisableBuiltInModelValidation option is set to false.
It would be great if we could disable validation on specific parameters with the existing [NeverValidate] attribute.
Expected behavior from the existing model validation is to:
I took a look in the action filter but it appears to be quite difficult to get the attributes of the parameter.
I'd be happy to take a look and implement if there is any interest in this.
The text was updated successfully, but these errors were encountered: