adopted-ember-addons / adopted-ember-addons/ember-validators

date validator: inconsistent meaning of allowBlank

Ouverte
#65 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
23
Forks
38
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

The [date validation](https://github.com/offirgolan/ember-validators/blob/fbca781275be19281ac8b568a1720f4f03e005eb/addon/date.js#L17-L39) 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](https://github.com/offirgolan/ember-validators/blob/fbca781275be19281ac8b568a1720f4f03e005eb/addon/number.js#L14-L15) 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.

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.