fun <AllT : Any, ValueT> ProcessedArgument<AllT, ValueT>.validate(validator: ArgValidator<AllT>): ArgumentDelegate<AllT>
Check the final argument value and raise an error if it's not valid.
The validator is called with the final argument type (the output of transformAll), and should call
fail
if the value is not valid.
You can also call require
to fail automatically if an expression is false.
Example:
val opt by argument().int().validate { require(it % 2 == 0) { "value must be even" } }