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

NotNull validation with Optional field #230

Open
benjamin-dreux opened this issue Dec 22, 2024 · 0 comments
Open

NotNull validation with Optional field #230

benjamin-dreux opened this issue Dec 22, 2024 · 0 comments

Comments

@benjamin-dreux
Copy link

This is related to the same as : #222
But with another context

The issue will be raised if you have a Optional<Long> and you wish to have a value defined.

@NotNull @With Optional<Long> seems to validate that the field is not a null value.

But if you set this up this way: @With Optional<@NotNull Long> fieldName, you will have the following error at compile time

annotation @javax.validation.constraints.NotNull not applicable in this type context

Maybe what should be added is add support for optional on the NotEmpty annotation

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

1 participant