Hi,
I’m trying to accumulate some validation errors with
zipOrAccumulate
. Something like this:
object MyError
fun example(input1: String, input2: String, input3: String): Either<NonEmptyList<MyError>, String> = either {
zipOrAccumulate(
{ ensure(input1.isNotBlank()) { MyError } },
{ ensure(input2.isNotBlank()) { MyError } },
{ ensure(input3.isNotBlank()) { MyError } }
) { _, _, _ ->
TODO()
}
}
Everything was smooth sailing until I encountered a model for which I need to do more than 9 validations.
I found this post on Stackoverflow, which describes the same issue for the deprecated
zip
function:
https://stackoverflow.com/questions/72782045/arrow-validation-more-then-10-fields/72782420#72782420
I’m not sure how to apply this to
zipOrAccumulate
. Any hints on how to handle this would be greatly appreciated! 😊