Possible Enhancement: Modification of value to be verified in RuleFor
See original GitHub issueFirst off, great library. Thanks for the excellent work here. But I was looking for one feature and I couldn’t find it. I think it may be an enhancement that could be useful to many developers.
In my domain, we get a lot of untrimmed strings, prefixed strings and so on. What I want to validate is a transformed value, not the original value. An example follows.
RuleFor(m => m.TransactionId).Transform(t => t.TrimStart("0")).NotEmpty()
It is true that this can be done in custom rules or using Must, but I’m wondering if there is enough interest and use of this pattern to make something like this available. It seems more fluent to me in a way that just using Must.
Interested in feedback and discussion, if enough interest exists, I (or others) can explore how to best add to the library if it makes sense. I totally accept that such as change may not be practical or expedient.
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
I’ve released 7.5 to nuget today that includes this fix.
Re-opening to track development progress.