Property Type: string
Strings represent a text value and can be configured with validators to limit input using regular expressions, and to enforce minimum and maximum lengths.
Property Options
Name | Type | Default | Description |
---|---|---|---|
trim | boolean | false | Trims the input string prior to validation but after writers. |
lowercase | boolean | false | Lowercase the input string prior to validation but after writers. |
uppercase | boolean | false | Uppercase the input string prior to validation but after writers. |
Property Validators
Required
name: required
String Validator
name: string
definition:
Name | Type | Default | Description |
---|---|---|---|
min | integer | 0 | Minimum length of string |
max | integer | Maximum length of string | |
allowNull | boolean | false | Allow null values |
allowEmpty | boolean | false | Allow 0-length strings |
Printable String Validator
name: printableString
definition:
Name | Type | Default | Description |
---|---|---|---|
anyFirstLetter | boolean | true | Allow the first letter of the string to be non-alphanumeric. |
allowNumberAsFirstLetter | boolean | true | Allows a number as the first letter of the string. |
min | integer | 0 | min length |
max | integer | max length |
String Enum Validator
name: stringEnum
definition:
Name | Type | Default | Description |
---|---|---|---|
values | array | An array of possible entries. |
Email Validator
name: email
definition:
Name | Type | Default | Description |
---|---|---|---|
allowNull | boolean | true | Allow blank or null entries |
Locale Validator
name: locale
definition:
Name | Type | Default | Description |
---|---|---|---|
allowNull | boolean | false | Allow blank or null entries |
Password Strength Validator
name: passwordStrength
definition:
Name | Type | Default | Description |
---|---|---|---|
minScore | integer | The minimum password score requirement (based on zxcvbn) |
Phone Number Strength Validator
name: phoneNumber
definition:
Name | Type | Default | Description |
---|---|---|---|
allowNull | boolean | false | Allow null entries. |
requireMobile | boolean | false | If true, requires the number to be a mobile number. |
allowedCountries | array or strings | List of allowed countries |
URL Validator
name: url
definition:
Name | Type | Default | Description |
---|---|---|---|
allowNull | boolean | false | Allow null values |
allowEmpty | boolean | false | Allow 0-length strings |
webOnly | boolean | true | Url must be a web url, beginning with http:// or https:// |
webSecure | boolean | Applies when webOnly is true. If present, url must either be https:// (true) or http:// (false). Omitting this property allows either. |
Pattern Validator
name: pattern
definition:
Name | Type | Default | Description |
---|---|---|---|
allowNull | boolean | false | Allow null values |
allowEmpty | boolean | false | Allow 0-length strings |
pattern | regex | The regex pattern to test against the incoming string value |