String Validators
Validators for String are :
Name | Usage in composition syntax | Usage in implicit syntax | Description | Error codes |
---|---|---|---|---|
Empty string | emptyString |
.empty |
Fails if string is not empty | empty_expected |
None empty string | notEmpty |
.notEmptyString |
Fails if string is empty | empty_field |
email |
.email |
Fails if string is not email | email_field |
|
Password | password() |
.password |
Fails if string is not at least 8 characters long and not contains 1 number and 1 special symbol and big and small letters | minimal_length min_count_symbols min_count_digits min_count_lower_case min_count_upper_case |
Minimal length | minimalLengthString(8) |
.minimalLength(8) |
Fails if length is greater or equal minimal value | minimal_length |
Maximal length | maximalLengthString(8) |
.maximalLength(8) |
Fails if length is lower or equal maximal value | maximal_length |
Expected length | exactLengthString(8) |
.exactLength(8) |
Fail if length is not exactly same value defined in function | expected_length |
Contains symbols | minimalCountSymbols(1, <list of symbols>) |
.containsSymbols(1, <list of symbols>) |
Fail if count of symbols is lower of minimal value | min_count_symbols |
Contains digits | minimalCountDigits(1) |
.containsDigits(1) |
Fail if count of digits is lower of minimal value | min_count_digits |
Contains lower case characters | minimalCountLowerCases(1) |
.containsLowerCase(1) |
Fail if count of lower case characters is lower of minimal value | min_count_lower_case |
Contains upper case characters | minimalCountUpperCases(1) |
.containsUpperCase(1) |
Fail if count of upper case characters is lower of minimal value | min_count_upper_case |
Contains string | contains(<expected value>) |
.contains(<expected value>) |
Fail if value does not contain expected value | value_contains |
Contains one of values | containsAtLeastOne(<expected list of values value>) |
.containsAtLeastOne(<expected list of values value>) |
Fail if value does not contain at least one of expected values | one_of_values_contains |
Equal one of values | equalAtLeastOne(<expected list of values value>) |
.equalAtLeastOne(<expected list of values value>) |
Fail if value does not equal at least one of expected values | one_of_values_missing |