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

Use isOmitted rather than isPresent in ValueExtractor to allow validation of null arguments #842

Closed
wants to merge 1 commit into from

Conversation

koenpunt
Copy link
Contributor

@koenpunt koenpunt commented Oct 23, 2023

isPresent() returns false, even when an explicit null value is supplied. By checking isOmitted() instead, we can correctly use validation annotations like @NotBlank.

Will see if I can update the tests for this as well. Tests have been updated.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Oct 23, 2023
`isPresent()` returns false, even when an explicit `null` value is supplied. By checking `isOmitted()` instead, we can correctly use validation annotations like `@NotBlank`.
@rstoyanchev rstoyanchev self-assigned this Oct 25, 2023
@rstoyanchev rstoyanchev added this to the 1.2.4 milestone Oct 25, 2023
@rstoyanchev rstoyanchev added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Oct 25, 2023
@rstoyanchev rstoyanchev changed the title also allow null argument values to be validated Use isOmitted rather than isPresent in ValueExtractor to allow validation of null arguments Oct 25, 2023
Copy link
Contributor

@rstoyanchev rstoyanchev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks.

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

Successfully merging this pull request may close these issues.

3 participants