keithasaurus / koda-validate

Typesafe, Composable Validation
MIT License
112 stars 0 forks source link

Document when coercion happens in the validation sequence #29

Closed koterpillar closed 1 year ago

koterpillar commented 1 year ago

Processors documentation says:

Processors are most useful after type validation, but before predicates are checked.

However, Coercion documentation doesn't tell me when is coercion performed - before the type validation inherent to a particular validator, after or instead of it.

As someone new to Koda, I'd like to have:

keithasaurus commented 1 year ago

Thanks. I'll think about how to better message this. What the statement about processors is trying to convey is that if you write your own Validators, you are free to use Processors; or not, but if you do it usually makes sense after you've established the type.

One of the ideas of Koda Validate is that the built-in validators largely adhere to the same form, but they don't always -- not arbitrarily, but because it doesn't always make sense. So unfortunately, it's not possible at present to say how all built-in Validators behave universally. I understand why that might not be intuitive, so I need to figure out how to cover it better.