PrefixItemsRule class final
Validates array elements positionally against a list of per-index schemas.
Corresponds to prefixItems in JSON Schema spec §6.4.1 (2020-12). Element
at index i is validated against schemas[i]. If the array is shorter than
the prefix list, the extra prefix schemas simply do not apply — there is no
violation for a short array. Elements beyond the prefix are not validated by
this rule; use ArrayRule with an ArrayRule.items schema to constrain
those.
Non-array instances are silently skipped (no violation).
- Inheritance
-
- Object
- SchemaRule
- PrefixItemsRule
Constructors
-
PrefixItemsRule(List<
SchemaRule> schemas) -
Creates a rule that validates positional elements against
schemas.const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
schemas
→ List<
SchemaRule> -
Per-index sub-schemas.
schemas[i]is applied to elementi.final
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