class Athena::Validator::Violation::ConstraintViolationBuilder(Root)
inherits Reference
#
Basic implementation of AVD::Violation::ConstraintViolationBuilderInterface
.
Included modules
Athena::Validator::Violation::ConstraintViolationBuilderInterface
Class methods#
.new(violations : AVD::Violation::ConstraintViolationListInterface, constraint : AVD::Constraint?, message : String, parameters : Hash(String, String), root : Root, property_path : String, invalid_value : AVD::Container)
#
(violations : AVD::Violation::ConstraintViolationListInterface, constraint : AVD::Constraint?, message : String, parameters : Hash(String, String), root : Root, property_path : String, invalid_value : AVD::Container)
Methods#
#add_parameter(key : String, value : _) : AVD::Violation::ConstraintViolationBuilderInterface
#
(key : String, value : _) : AVD::Violation::ConstraintViolationBuilderInterface
Adds a parameter with the provided key and value to the violations' AVD::Violation::ConstraintViolationInterface#parameters
.
The provided value is stringified via #to_s
before being added to the parameters.
Returns self
for chaining.
#at_path(path : String) : AVD::Violation::ConstraintViolationBuilderInterface
#
(path : String) : AVD::Violation::ConstraintViolationBuilderInterface
Sets the AVD::Violation::ConstraintViolationInterface#property_path
.
Returns self
for chaining.
#cause(cause : String?) : AVD::Violation::ConstraintViolationBuilderInterface
#
(cause : String?) : AVD::Violation::ConstraintViolationBuilderInterface
Sets the AVD::Violation::ConstraintViolationInterface#cause
Returns self
for chaining.
#code(code : String?) : AVD::Violation::ConstraintViolationBuilderInterface
#
(code : String?) : AVD::Violation::ConstraintViolationBuilderInterface
Sets the AVD::Violation::ConstraintViolationInterface#code
Returns self
for chaining.
#constraint(constraint : AVD::Constraint?) : AVD::Violation::ConstraintViolationBuilderInterface
#
(constraint : AVD::Constraint?) : AVD::Violation::ConstraintViolationBuilderInterface
Sets the AVD::Violation::ConstraintViolationInterface#constraint
Returns self
for chaining.
#invalid_value(value : _) : AVD::Violation::ConstraintViolationBuilderInterface
#
(value : _) : AVD::Violation::ConstraintViolationBuilderInterface
Sets the AVD::Violation::ConstraintViolationInterface#invalid_value
Returns self
for chaining.
#plural(plural : Int32) : AVD::Violation::ConstraintViolationBuilderInterface
#
(plural : Int32) : AVD::Violation::ConstraintViolationBuilderInterface
Sets AVD::Violation::ConstraintViolationInterface#plural
Returns self
for chaining.
#set_parameters(parameters : Hash(String, String)) : AVD::Violation::ConstraintViolationBuilderInterface
#
(parameters : Hash(String, String)) : AVD::Violation::ConstraintViolationBuilderInterface
Overrides the entire AVD::Violation::ConstraintViolationInterface#parameters
hash with the provided parameters.
Returns self
for chaining.