abstract class Athena::Validator::Constraints::Composite
inherits Athena::Validator::Constraint
#
A constraint composed of other constraints. handles normalizing the groups of the nested constraints, via the following algorithm:
- If groups are passed explicitly to the composite constraint, but not to the nested constraints, the options of the composite constraint are copied to the nested constraints
- If groups are passed explicitly to the nested constraints, but not to the composite constraint, the groups of all nested constraints are merged and used as groups for the composite constraint
- If groups are passed explicitly to both the composite and its nested constraints, the groups of the nested constraints must be a subset of the groups of the composite constraint.
Note
You most likely want to use AVD::Constraints::Compound
instead of this type.
Direct known subclasses
Athena::Validator::Constraints::All
Athena::Validator::Constraints::AtLeastOneOf
Athena::Validator::Constraints::Collection
Athena::Validator::Constraints::Compound
Athena::Validator::Constraints::Existence
Athena::Validator::Constraints::Sequentially
Constructors#
.new(constraints : AVD::Constraints::Composite::Type, message : String, groups : Array(String) | String | Nil = nil, payload : Hash(String, String) | Nil = nil)
#
Methods#
#add_implicit_group(group : String) : Nil
#
Adds the provided group to #groups
if self
is in the AVD::Constraint::DEFAULT_GROUP
.