hey Guys, need some help. I need to aggregate all ...
# arrow
h
hey Guys, need some help. I need to aggregate all failed validations into a list of errors. Something like this but don’t know what to put in the TODO
Copy code
val validations = listOf(
            validateA("field1", request.prop1),
            validateB("field2", request.prop2)
        )
            .filter { v -> v.isInvalid }
            . // TODO -> how to get only the left side (the error) 
              // ValidateA return Validated<Error, String>   
              // ValidateB return Validated<Error, String>   
            

        return if (validations.isNotEmpty()) {
            Validated.Invalid(validations)

        } else {
            Validated.Valid(configuration)
        }