public override void OnConfigure( IDescriptorContext context, IArgumentDescriptor descriptor, ParameterInfo parameter) { if (parameter.GetCustomAttribute <ValidateAttribute>() is not ValidateAttribute attr) { return; } descriptor.ValidateWith(attr.ValidatorTypes); }
/// <summary> /// Instructs FairyBread to add the given validator to the argument. /// </summary> public static IArgumentDescriptor ValidateWith <TValidator>( this IArgumentDescriptor descriptor) where TValidator : IValidator { return(descriptor.ValidateWith(typeof(TValidator))); }