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

Fix Length Validator passing None when min=0 #873

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

jb2170
Copy link

@jb2170 jb2170 commented Dec 19, 2024

Closes #872

I don't think any fields other than StringField use the Length validator, so there's no need for an extra elif not field.data: length = 0 line to apply to falsey values: Truthy data likewise would need to implement the len operator in the pre-existing implementation which only string data does. So everything is good.

I've included three stress-test / edge-case scenarios that make the distinction between None and '' clear. The pre-existing implementation fails these tests, and with this PR they pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Length Validator Broken when min=0
1 participant