We’ve created the basics of our validation library, but we haven’t yet addressed the problem of aggregation. How do we make it easy for our consumers to combine multiple validation results together into one. Ideally, we want this to be so simple that they don’t have to think about it at all.
Following on from last week’s introduction of the plus operator, a friend of mine challenged me to consider an alternative operator for combining validation results:
While writing tests for the code presented in the last couple of weeks, I discovered a notable bug caused by an ommission in the code. If you’re a regular reader of this blog, you may have already spotted what was left out.
Let’s recap what we’ve achieved so far with our semantic types for validation. We’ve created a handful of types that work together to give a good model for capturing and processing object validation. The model starts with the base class
ValidationResult and its subclasses: