Feature #45164

Define syntax for validation rules in YAML

Added by Karsten Dambekalns almost 9 years ago.

Status:
Accepted
Priority:
Should have
Category:
-
Target version:
-
Start date:
2013-02-05
Due date:
% Done:

0%

Estimated time:

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 NamingAcceptedSebastian Kurfuerst2012-10-20

Actions
Related to Base Distribution - Story #44982: Refactor Node Type Definition according to new syntaxResolved2013-01-30

Actions

No data to display

Also available in: Atom PDF