Closed Bendzae closed 2 hours ago
Thanks for the proposal. Currently not interested in doing this for mainly 2 reasons:
You can take a look at Arrow's Either, which has the customizable error type.
For the specific example given I would personally probably make a Validation
per severity level, and then collect them using the ValidationResult.errors
list with a severity attached
Alright that makes a lot of sense. Thank you for the quick reply and great work on konform anyways!
Context
Currently a hint or errorMessage has to be a string. It would be great to be able to supply a custom type for these to allow a more flexibility in the we different applications might model their errors.
Proposed solution
Validation
class:Validation<T,E>
whereE
is the type of the error format.Of course library default messages like "is required" would need to be customisable then (which would be a great feature anyways).
I would be more then happy to create a PR to implement this if it is something that could be considered 🙂