module Athena::Validator::Violation::ConstraintViolationInterface
#
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
Athena::Validator::Violation::ConstraintViolation
Methods#
abstract #code : String | ::Nil
#
Returns a unique machine readable error code representing self.
All constraints of a specific "type" should have the same code.
abstract #constraint : AVD::Constraint | ::Nil
#
Returns the AVD::Constraint
whose validation caused the violation, if any.
abstract #message_template : String | ::Nil
#
Returns the raw violation message.
The message template contains placeholders for the parameters returned via #parameters
.
abstract #parameters : Hash(String, String)
#
Returns the parameters used to render the #message_template
.
abstract #plural : Int32 | ::Nil
#
Returns a number used to pluralize the violation message.
The returned value is used to determine the right plurlaization form.
abstract #property_path : String
#
Returns the path from the root element to the violation.
abstract #to_json(builder : JSON::Builder) : Nil
#
Returns a JSON
representation of self
.