struct Athena::Validator::Violation::ConstraintViolation(Root)
- Athena::Validator::Violation::ConstraintViolation(Root)
- Struct
- Value
- Object
Overview
Basic implementation of AVD::Violation::ConstraintViolationInterface
.
Included Modules
Defined in:
violation/constraint_violation.crConstructors
Instance Method Summary
-
#==(other : self) : Bool
Returns
true
if other is the same asself
, otherwisefalse
. -
#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
Returns the
AVD::Constraint
whose validation caused the violation, if any. -
#constraint? : AVD::Constraint | Nil
:inherit:
-
#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 : 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 methods inherited from module Athena::Validator::Violation::ConstraintViolationInterface
cause : String | Nil
cause,
code : String | Nil
code,
constraint : AVD::Constraint | Nil
constraint,
invalid_value
invalid_value,
message : String
message,
message_template : String | Nil
message_template,
parameters : Hash(String, String)
parameters,
plural : Int32 | Nil
plural,
property_path : String
property_path,
root
root,
to_json(builder : JSON::Builder) : Nil
to_json,
to_s(io : IO) : Nil
to_s
Constructor Detail
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.