FluentValidation.AutoValidation icon indicating copy to clipboard operation
FluentValidation.AutoValidation copied to clipboard

Add ability to run specific rule sets

Open yzinc opened this issue 9 months ago • 3 comments

Hi! Currently we are limited to run rule sets during autovalidation. I believe we can add specific attribute for such purposes. I came up with, following naming pattern, next attribute

    [AttributeUsage(AttributeTargets.Parameter)]
    public class AutoValidateSpecificAttribute : Attribute
    {
        public string[] RuleSets { get; }

        public AutoValidateSpecificAttribute(params string[] ruleSets)
        {
            RuleSets = ruleSets;
        }
    }

and then get and use those rulesets in filter.

yzinc avatar Feb 22 '25 13:02 yzinc