Feature #45164
Define syntax for validation rules in YAML
| Status: | Accepted | Start date: | 2013-02-05 | |
|---|---|---|---|---|
| Priority: | Should have | Due date: | ||
| Assigned To: | Karsten Dambekalns | % Done: | 0% |
|
| Category: | - | |||
| Target version: | - |
Description
To be able to define validation rules in YAML will be helpful in a number of cases, like for node types, validation of free-form documents (think about NoSQL), …
Here is a suggestion for defining validation rules:
validation:
-
type: 'NotEmpty'
-
type: 'RegularExpression'
options:
regularExpression: '(0?[1-9]|[12][0-9]|3[01])[\\/\\-](0?[1-9]|1[012])[\\/\\-]\\d{4}'
-
preset: 'MakeLifeEasierForBram'
validation can have any number of elements, type follows the same rules as with the Validate annotation and options can hold any options that a validator accepts.
One new thing is preset, which is pointing to a predefined set of rules. Such a preset can be defined like this:
validationPreset:
'MakeLifeEasierForBram':
-
type: 'NotEmpty'
-
type: 'StringLength'
options:
maximum: 7
-
type: 'RegularExpression'
options:
regularExpression: '[a-f56-]+'
Related issues