michaellperry / Assisticant

MIT License
36 stars 19 forks source link

Add an overrideable message context type #24

Closed floyd-may closed 7 years ago

floyd-may commented 7 years ago

Allright @michaellperry,

Hopefully this will get this thing whooped into shape. The thing that vexed me about the previous one is that you could tack on as many .WithMessage(...) calls as you wanted. The extension methods for the numeric and string specific validators now return this new OptionalMessagePropertyValidationContext which dumps you back at a PropertyValidationContext after a single .WithMessage(...). Should be doing a good job of making invalid states unrepresentable. LMK if it sucks 😄

floyd-may commented 7 years ago

And just so you know, I'm using this series of PRs as a case study for my KCDC talk on fluent APIs if it gets accepted 😸

michaellperry commented 7 years ago

The merge was bad, so I just force-pushed a reset of errorinfo back to where I could accept your first commit.

I like how OptionalMessagePropertyValidationContext takes care of that null check. Now to just put a bow on it and ship it!