Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 27d13b3

Browse filesBrowse files
committed
[Validator] Update NotBlank and Length validators pages with the new trimming options
- Add "trim" option to the NotBlank page - Add "ltrim", "rtrim" and "mergeConsecutiveWhitespaces" options to the Length page
1 parent f1fe443 commit 27d13b3
Copy full SHA for 27d13b3

File tree

2 files changed

+32
-0
lines changed
Filter options

2 files changed

+32
-0
lines changed

‎reference/constraints/Length.rst

Copy file name to clipboardExpand all lines: reference/constraints/Length.rst
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,30 @@ max
133133
This required option is the "max" length value. Validation will fail if
134134
the given value's length is **greater** than this max value.
135135

136+
ltrim
137+
~~~~~
138+
139+
**type**: ``boolean`` **default**: ``null``
140+
141+
If ``true``, every kind of whitespace from the **beginning** of the given value
142+
will be ignored while checking for its length.
143+
144+
rtrim
145+
~~~~~
146+
147+
**type**: ``boolean`` **default**: ``null``
148+
149+
If ``true``, every kind of whitespace from the **end** of the given value will
150+
be ignored while checking for its length.
151+
152+
mergeConsecutiveWhitespaces
153+
~~~~~~~~~~~~~~~~~~~~~~~~~~~
154+
155+
**type**: ``boolean`` **default**: ``null``
156+
157+
If ``true``, consecutive whitespaces will count as a single character while
158+
checking for the given value's length.
159+
136160
charset
137161
~~~~~~~
138162

‎reference/constraints/NotBlank.rst

Copy file name to clipboardExpand all lines: reference/constraints/NotBlank.rst
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,4 +94,12 @@ message
9494

9595
This is the message that will be shown if the value is blank.
9696

97+
trim
98+
~~~~
99+
100+
**type**: ``boolean`` **default**: ``null``
101+
102+
If ``true`` and if the given value is a ``string``, every kind of whitespace will be
103+
ignored while checking if it is not blank.
104+
97105
.. include:: /reference/constraints/_payload-option.rst.inc

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.