Feature #45164

Define syntax for validation rules in YAML

Added by Karsten Dambekalns over 2 years ago.

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

related to Base Distribution - Story #44921: Decide TypoScript and TYPO3CR Naming Accepted 2012-10-20
related to Base Distribution - Story #44982: Refactor Node Type Definition according to new syntax Resolved 2013-01-30

Also available in: Atom PDF