Validators
Common Properties¶
type
* specifies which validator type to use.errorMsg
* displays a custom error message. UCC provides default error messages.
String¶
Properties
minLength
* specifies the minimum number of characters allowed.maxLength
* specifies the maximum number of characters allowed.
See the following example usage:
{
"type": "string",
"errorMsg": "Length of index name should be between 1 to 80 characters.",
"minLength": 1,
"maxLength": 80
}
Regex¶
Properties
pattern
* is a Regex pattern.
See the following example usage:
{
"type": "regex",
"errorMsg": "Input Name must begin with a letter and consist exclusively of alphanumeric characters and underscores.",
"pattern": "^[a-zA-Z]\\w*$"
}
Number¶
Properties
range
* is the range within which the target value should fall.
See the following example usage:
{
"type": "number",
"range": [
1,
65535
]
}
URL¶
No parameters are needed.
If you’re using a regexp internally, this regex checks whether a field value is a URL or not.
Email¶
No parameters are needed.
Using a regexp internally is recommended by WHATWG.
IPV4¶
No parameters are needed.
Internally, it checks the IPV4 address using this regex.
Date¶
No parameters are needed.
It is validated if the field’s value is a date in the ISO 8601 format. It uses the regex from moment.js.