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