Skip to content

Do not put validation annotaiton if return type is a nullable list having non-null values #959

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

Closed
kobylynskyi opened this issue Feb 9, 2022 Discussed in #955 · 1 comment
Assignees
Labels
bug Something isn't working
Milestone

Comments

@kobylynskyi
Copy link
Owner

Discussed in #955

Originally posted by siva54 January 31, 2022
Hi,
I was trying to generate the schema with a List type and came across some issues. As per the schema we have different use cases for a not-null condition for a list,
image
In my project, I'm using a couple of cases too such as,
[Int!] - This means that the list can be null but cannot have null objects in the list.
[Int]! - This means that the list cannot be null but can have null objects in the list.
When using codegen to generate POJOs, for types with
[Int!]
[Int]!

In both cases, the field is being annotated with,
@javax.validation.constraints.NotNull

This basically means that the List cannot be null. This is incorrect for the type [Int!] and caused some trouble. As of now, I replaced all the NotNull to instead use a PlaceboValidation annotation of mine that does nothing. How do I overcome this and make sure to ensure that the POJO created works as expected?

@kobylynskyi
Copy link
Owner Author

Will be released as part of version 5.4.1 #980

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant