Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

forEach does not work sensibly with primitive list #301

Closed
anton-kapelyushok opened this issue Dec 7, 2022 · 3 comments
Closed

forEach does not work sensibly with primitive list #301

anton-kapelyushok opened this issue Dec 7, 2022 · 3 comments

Comments

@anton-kapelyushok
Copy link

anton-kapelyushok commented Dec 7, 2022

@Value 
class A {
   List<String> data;
}


// I have to write like this:
ValidatorBuilder.<A>of()
                .forEach(A::getData, "data", s -> s._string(it -> it, "", it -> it.notBlank()))
                .build();

// Instead of this:
ValidatorBuilder.<A>of()
                ._forEachString(A::getData, "data", it -> it.notBlank())
                .build();

Or may be I can, but it is certainly missing from documentation

@anton-kapelyushok
Copy link
Author

anton-kapelyushok commented Dec 7, 2022

And similar issue with Collections as top object

var aValidator = ValidatorBuilder.<A>of().build();
var listValidator = ValidatorBuilder.<List<A>>of()
         // ??? - does not compile without explicit type
        .forEach((ValidatorBuilder.ToCollection<List<A>, List<A>, A>) o -> o, "", aValidator)
        .build();

@making
Copy link
Owner

making commented Dec 8, 2022

That's expected

@making making closed this as not planned Won't fix, can't repro, duplicate, stale Dec 8, 2022
@making
Copy link
Owner

making commented Dec 8, 2022

For the latter use case, I would use a single value validator and liftList method
https://yavi.ik.am/#define-validator-for-a-single-value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants