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

date validator: inconsistent meaning of allowBlank #65

Open
bgentry opened this issue Apr 4, 2018 · 1 comment
Open

date validator: inconsistent meaning of allowBlank #65

bgentry opened this issue Apr 4, 2018 · 1 comment

Comments

@bgentry
Copy link
Contributor

bgentry commented Apr 4, 2018

The date validation has an option isBlank which is documented like so:

If true, skips validation if the value is empty

This accurately describes the implementation, which skips validation if isEmpty returns true for the value.

Other validators use allowBlank in combination with an isBlank check, and allowNone for an isEmpty check. This is inconsistent; blank should always mean blank, and empty/none should always mean empty.

There may be other validators with this problem, but I haven't checked.

Should this be fixed, and if so, how? One option is to deprecate the current allowBlank option in favor of allowNone, which would behave the same way. At the next major release, you could then add a real allowBlank option if desired.

@offirgolan
Copy link
Collaborator

offirgolan commented Apr 5, 2018

@bgentry you're right. There are definitely some inconsistencies here. What are your thoughts about instead using allowNone which will use Ember.isNone and allowEmpty which will use Ember.isEmpty? All of which can be defaulted to false and we can do a major version release.

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

2 participants