Class: Udb::ArrayConstraints
- Inherits:
-
T::Struct
- Object
- T::Struct
- Udb::ArrayConstraints
- Defined in:
- lib/udb/z3.rb
Overview
Aggregates all JSON schema constraints for an array parameter
This struct collects various array validation rules from JSON schemas:
- Position-specific item schemas (tuple validation)
- General item schema for remaining positions
- "contains" requirement (at least one matching item)
- Uniqueness constraint
- Size bounds (min/max)
Instance Attribute Summary collapse
-
#contains ⇒ TypeConstraint?
When present, array must contain at least one item matching this schema.
-
#item_by_idx ⇒ Hash{Integer => TypeConstraint}
Schema applied to specific array positions (for tuple-style arrays).
-
#item_rest ⇒ TypeConstraint?
Schema applied to all positions not covered by item_by_idx.
-
#max_size ⇒ Integer?
Maximum number of elements allowed.
-
#min_size ⇒ Integer?
Minimum number of elements required.
-
#unique ⇒ Boolean
Whether array items must be unique (JSON schema "uniqueItems").
Instance Method Summary collapse
- #initialize(item_by_idx: {}, item_rest: nil, contains: nil, unique: false, max_size: nil, min_size: nil) constructor
Constructor Details
#initialize(item_by_idx: {}, item_rest: nil, contains: nil, unique: false, max_size: nil, min_size: nil)
|
|
# File '' prop :item_by_idx, T::Hash[Integer, TypeConstraint], default: {} prop :item_rest, T.nilable(TypeConstraint) prop :contains, T.nilable(TypeConstraint) prop :unique, T::Boolean, default: false prop :max_size, T.nilable(Integer) prop :min_size, T.nilable(Integer) |
Instance Attribute Details
#contains ⇒ TypeConstraint?
When present, array must contain at least one item matching this schema
|
|
# File '' prop :contains, T.nilable(TypeConstraint) |
#item_by_idx ⇒ Hash{Integer => TypeConstraint}
Schema applied to specific array positions (for tuple-style arrays)
|
|
# File '' prop :item_by_idx, T::Hash[Integer, TypeConstraint], default: {} |
#item_rest ⇒ TypeConstraint?
Schema applied to all positions not covered by item_by_idx
|
|
# File '' prop :item_rest, T.nilable(TypeConstraint) |
#max_size ⇒ Integer?
Maximum number of elements allowed
|
|
# File '' prop :max_size, T.nilable(Integer) |
#min_size ⇒ Integer?
Minimum number of elements required
|
|
# File '' prop :min_size, T.nilable(Integer) |
#unique ⇒ Boolean
Whether array items must be unique (JSON schema "uniqueItems")
|
|
# File '' prop :unique, T::Boolean, default: false |