struct Athena::Validator::Violation::ConstraintViolation
inherits Struct
#
Basic implementation of AVD::Violation::ConstraintViolationInterface
.
Included modules
Athena::Validator::Violation::ConstraintViolationInterface
Constructors#
.new(message : String, message_template : String | Nil, parameters : Hash(String, String), root : _, property_path : String, invalid_value_container : AVD::Container, plural : Int32 | Nil = nil, code : String | Nil = nil, constraint : AVD::Constraint | Nil = nil, cause : String | Nil = nil)
#
Methods#
#==(other : AVD::Violation::ConstraintViolationInterface) : Bool
#
Returns true
if other is the same as self
, otherwise false
.
#code : String | ::Nil
#
Returns a unique machine readable error code representing self.
All constraints of a specific "type" should have the same code.
#constraint : AVD::Constraint
#
Returns the AVD::Constraint
whose validation caused the violation, if any.
#message_template : String | ::Nil
#
Returns the raw violation message.
The message template contains placeholders for the parameters returned via #parameters
.
#parameters : Hash(String, String)
#
Returns the parameters used to render the #message_template
.
#plural : Int32 | ::Nil
#
Returns a number used to pluralize the violation message.
The returned value is used to determine the right plurlaization form.