Skip to content

Commit df3cdef

Browse files
David Fuhrweaverryan
David Fuhr
authored andcommitted
Clearify behaviour of Blank and NotBlank validator
| Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.3+ | Fixed tickets |
1 parent cb3fa20 commit df3cdef

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

reference/constraints/Blank.rst

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@ Blank
33

44
Validates that a value is blank, defined as equal to a blank string or equal
55
to ``null``. To force that a value strictly be equal to ``null``, see the
6-
:doc:`/reference/constraints/IsNull` constraint. To force that a value is
7-
*not* blank, see :doc:`/reference/constraints/NotBlank`.
6+
:doc:`/reference/constraints/IsNull` constraint.
7+
8+
9+
.. tip::
10+
11+
To force that a value is *not* blank, see
12+
:doc:`/reference/constraints/NotBlank`. But be careful as ``NotBlank`` is
13+
*not* strictly the opposite of ``Blank``. Emtpy array and strictly
14+
``false`` are considered blank by the ``NotBlank`` validator but not by the
15+
``Blank`` validator.
816

917
+----------------+---------------------------------------------------------------------+
1018
| Applies to | :ref:`property or method <validation-property-target>` |

reference/constraints/NotBlank.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ NotBlank
22
========
33

44
Validates that a value is not blank, defined as not strictly ``false``,
5-
not equal to a blank string and also not equal to ``null``. To force that
6-
a value is simply not equal to ``null``, see the
5+
not equal to a blank string, not an empty array and also not equal to ``null``.
6+
To force that a value is simply not equal to ``null``, see the
77
:doc:`/reference/constraints/NotNull` constraint.
88

99
+----------------+------------------------------------------------------------------------+

0 commit comments

Comments
 (0)