Skip to content

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

@kobylynskyi

Description

@kobylynskyi

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?

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions