ReactiveValidation icon indicating copy to clipboard operation
ReactiveValidation copied to clipboard

Add a new parameter to WithMessage

Open blahetal opened this issue 4 months ago • 2 comments

Hello, would you consider tweaking the function WithMessage a bit. I would like to provide a custom error message with a computed value derived from the object (view mode) being validated. Current version allows to provide a static text

RuleFor(vm => ...).LessThan(vm =>...).WithMessage("Error");

I would like to do something like this

RuleFor(vm => ...).LessThan(vm =>...).WithMessage(vm =>$"Error{vm....}");

Thanks, Libor

blahetal avatar Oct 31 '24 08:10 blahetal