PatternPropertiesRule class final
Validates object properties whose names match ECMA-262 regex patterns.
Corresponds to patternProperties in JSON Schema spec §6.5.5. For each
property in the instance, every pattern in patterns is tested against the
property name using RegExp.hasMatch (unanchored, per spec). If a pattern
matches, the associated sub-schema is applied to the property value. A
property may be matched by zero, one, or more patterns — every matching
sub-schema is applied and all violations are collected.
Non-object instances are silently skipped (no violation).
- Inheritance
-
- Object
- SchemaRule
- PatternPropertiesRule
Constructors
-
PatternPropertiesRule(List<
(RegExp, SchemaRule)> patterns) -
Creates a rule from a list of (regex, sub-schema) pairs.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
-
patterns
→ List<
(RegExp, SchemaRule)> -
The list of pattern→schema pairs.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
validate(
dynamic value, String path) → List< SchemaViolation> -
Validates
valueatpathand returns every violation found.override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited