I have the code
private static Validation<ConstraintViolation, List<Person>> validatePersonDetail(
List<PersonDetailRequest> personRequest) {
for (PersonRequest request:personRequest) {
if (isNull(request.getName())) {
return invalid(new ConstraintViolation("name", "name cannot be empty"));
}
..
// more validations
// build object
Person.builder().name(request.getName()).build();
}
return valid([PERSON_LIST]);
}
I want to return Person List but not sure how to go with Vavr. I cannot use Validation combine as it contains nested validations for nested objects