[MGNLUI-7019] Validators don't validate the value which will be stored (empty string vs null) Created: 20/Jan/22  Updated: 20/Jan/22  Resolved: 20/Jan/22

Status: Closed
Project: Magnolia UI
Component/s: app framework
Affects Version/s: 6.2.15
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Michiel Meeuwissen Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
causality
caused by MGNLUI-6245 Regex field validation has changed fo... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

Steps to reproduce

  1.  Define a field like so:
 twitter:
          required: false
          $type: textField
          validators:
            - name: regexp
              pattern: '[a-zA-Z0-9_]{1,15}'
              $type: regexpValidator

Fill in the empty string. The field is not required. It will not validate.

If I remove the validator, it will store, but not fill in the field. The empty string is interpreted as null.

But the regexpvalidator would have accepted null too.

 

This particular case can be easily worked around. But how about $type: emailValidator?


Generated at Mon Feb 12 09:42:19 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.