class documentation
class ValidationRule:
A validation rule for a property, e.g. ValidationRule(VALIDATION_RULE_TYPE.MAX_LENGTH, 200).
The rule is checked when it is constructed, so an invalid one never reaches a schema. Which rules a property may have depends on its datatype: an ENUM rule on an enum property, and REGEX, MIN_LENGTH and MAX_LENGTH rules on a text or keyword property.
| Raises | |
ValueError | If rule_type is not a VALIDATION_RULE_TYPE, or a
length is negative or a pattern is empty. |
TypeError | If rule has the wrong type for rule_type. |
| Method | __post |
Undocumented |
| Method | to |
The rule as it appears in a property's validationRules. |
| Instance Variable | rule |
The rule's value: a non-negative integer for MIN_LENGTH and MAX_LENGTH, a non-empty pattern string for REGEX, or a sequence of allowed values for ENUM (stored as a tuple). |
| Instance Variable | rule |
The kind of rule. A plain string such as 'maxLength' is converted to the matching VALIDATION_RULE_TYPE. |
The rule's value: a non-negative integer for MIN_LENGTH and MAX_LENGTH, a non-empty pattern string for REGEX, or a sequence of allowed values for ENUM (stored as a tuple).
The kind of rule. A plain string such as 'maxLength'
is converted to the matching VALIDATION_RULE_TYPE.