Skip to content

[Validator] Fix NotBlank validator to treat whitespace-only strings as blank #41

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Open
wants to merge 1 commit into
base: 7.0
Choose a base branch
from

Conversation

lionelkimbs
Copy link

@lionelkimbs lionelkimbs commented Mar 4, 2024

Problem:
The NotBlank validator previously failed to recognize strings consisting solely of whitespace characters (e.g., " " or " ") as blank.

Solution:
This PR updates the NotBlank validator's logic to treat strings that contain only whitespace characters as blank.

Key Changes:
Updated the validation logic in the NotBlankValidator class to trim value if type is string, then proceed to current checking.

Testing:
Comprehensive unit tests have been added to verify the correct behavior of the NotBlank validator with whitespace-only strings. All existing tests have been run to ensure that this change does not introduce regressions in other parts of the application.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant