Skip to content

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) #

View source

Methods#

#==(other : self) : Bool #

Returns true if other is the same as self, otherwise false.

View source

#cause : String? #

Returns the cause of the violation.

View source

#code : String? #

Returns a unique machine readable error code representing self. All constraints of a specific "type" should have the same code.

View source

#constraint : AVD::Constraint #

Returns the AVD::Constraint whose validation caused the violation, if any.

View source

#constraint? : AVD::Constraint? #

:inherit:

View source

#invalid_value #

Returns the value that caused the violation.

View source

#message : String #

Returns the violation message.

View source

#message_template : String? #

Returns the raw violation message.

The message template contains placeholders for the parameters returned via #parameters.

View source

#parameters : Hash(String, String) #

Returns the parameters used to render the #message_template.

View source

#plural : Int32? #

Returns a number used to pluralize the violation message.

The returned value is used to determine the right plurlaization form.

View source

#property_path : String #

Returns the path from the root element to the violation.

View source

#root : Root #

Returns the element originally passed to the validator.

View source

#to_json(builder : JSON::Builder) : Nil #

Returns a JSON representation of self.

View source

#to_s(io : IO) : Nil #

Returns a string representation of self.

View source