Encapsulates the logic for validating a given data-model and some optional metadata.
The validation logic itself is expressed by some function that must be passed as validate parameter. This function gets the actual model-data D and some optional metadata T in order to create a List of validation messages M. This value class simply wraps the provided validate function in order to make it invocable without any ceremony.
It appears to be a good practise, to put the implementation of the passed validate function right next to your data classes in the
commonMain section of your Kotlin multiplatform project. So you can write the validation logic once and use them on the JS and JVM side.