module Athena::Validator::Violation::ConstraintViolationInterface
Overview
Represents a violation of a constraint during validation.
Each failed constraint that fails during validation; one or more violations are created. The violations store the violation message, the path to the failing element, and the root element originally passed to the validator.
Direct including types
Defined in:
violation/constraint_violation_interface.crInstance Method Summary
-
#cause : String | Nil
Returns the cause of the violation.
-
#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 | Nil
Returns the
AVD::Constraint
whose validation caused the violation, if any. -
#invalid_value
Returns the value that caused the violation.
-
#message : String
Returns the violation message.
-
#message_template : String | Nil
Returns the raw violation message.
-
#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.
-
#property_path : String
Returns the path from the root element to the violation.
-
#root
Returns the element originally passed to the validator.
-
#to_json(builder : JSON::Builder) : Nil
Returns a
JSON
representation ofself
. -
#to_s(io : IO) : Nil
Returns a string representation of
self
.
Instance Method Detail
Returns a unique machine readable error code representing self.
All constraints of a specific "type" should have the same code.
Returns the AVD::Constraint
whose validation caused the violation, if any.
Returns the raw violation message.
The message template contains placeholders for the parameters returned via #parameters
.
Returns the parameters used to render the #message_template
.
Returns a number used to pluralize the violation message.
The returned value is used to determine the right plurlaization form.