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

Constraints for list not included in schema #2131

Open
robp94 opened this issue Jun 24, 2024 · 2 comments
Open

Constraints for list not included in schema #2131

robp94 opened this issue Jun 24, 2024 · 2 comments

Comments

@robp94
Copy link
Contributor

robp94 commented Jun 24, 2024

If I have a class like this:

public class TestObject {
    private List<@Pattern(regexp = "^1") String> list;

    @Pattern(regexp = "^1")
    private String nonList;
    ...

I get a schema like this:

input TestObjectInput {
  list: [String]
  nonList: String @constraint(pattern : "^1")
}

For the type of the list, the constraint is not in the schema. Constraints for the list like max/min length do work.

@jmartisk
Copy link
Member

I guess this is just another variation on #1366
We've made some progress in scanning generic types, but apparently there are still some gaps.

@mskacelik
Copy link
Contributor

mskacelik commented Jun 28, 2024

Most importantly, I think we do not yet support wrapper directives (and constraints directives via bean validation). I have started to work on the feature, but it will take some time to implement.

For #1366, the problem was that if the type argument contained @NonNull, every wrapper was non-null.
See:

private static boolean markParameterizedTypeNonNull(Type fieldType, Type methodType) {

if (wrapper != null && wrapper.isCollectionOrArrayOrMap()) {

List<Set<Collection<@NonNull Integer>>> => [[[Int!]!]!]!
List<Set<@NonNull Collection<Integer>>> => [[[Int]]]
I might have fixed the issue locally, but I still need to test it...

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

3 participants