Skip to content

[Validator] Add warning for null and blank values for minimum string length #6270

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

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions reference/constraints/Length.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
Length
======

Validates that a given string length is *between* some minimum and maximum
value.
Validates that a given string length is *between* some minimum and maximum value.

**Warning**: *null* and *blank* values are not handled by this constraint. To
handle them, refers to the :doc:`/reference/constraints/Null`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo here: refer

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@xabbuh does this generic warning message is good for you? I would like to agree on the message in one place first before applying it everywhere needed.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write it like "null and the empty string are not handled by this constraint. Additionally add the NotBlank or NotNull constraint to exclude these values."

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and then we should add it in a caution block

:doc:`/reference/constraints/NotNull`, :doc:`/reference/constraints/Blank` and
:doc:`/reference/constraints/NotBlank` constraints.

+----------------+----------------------------------------------------------------------+
| Applies to | :ref:`property or method <validation-property-target>` |
Expand Down