class Athena::Validator::Violation::ConstraintViolationBuilder(Root)

Overview

Basic implementation of AVD::Violation::ConstraintViolationBuilderInterface.

Included Modules

Defined in:

violation/constraint_violation_builder.cr

Constructors

Instance Method Summary

Instance methods inherited from module Athena::Validator::Violation::ConstraintViolationBuilderInterface

add : Nil add, add_parameter(key : String, value : _) : AVD::Violation::ConstraintViolationBuilderInterface add_parameter, at_path(path : String) : AVD::Violation::ConstraintViolationBuilderInterface at_path, cause(cause : String | Nil) : AVD::Violation::ConstraintViolationBuilderInterface cause, code(code : String | Nil) : AVD::Violation::ConstraintViolationBuilderInterface code, constraint(constraint : AVD::Constraint | Nil) : AVD::Violation::ConstraintViolationBuilderInterface constraint, invalid_value(value : _) : AVD::Violation::ConstraintViolationBuilderInterface invalid_value, plural(number : Int32) : AVD::Violation::ConstraintViolationBuilderInterface plural, set_parameters(parameters : Hash(String, String)) : AVD::Violation::ConstraintViolationBuilderInterface set_parameters

Constructor Detail

def self.new(violations : AVD::Violation::ConstraintViolationListInterface, constraint : AVD::Constraint | Nil, message : String, parameters : Hash(String, String), root : Root, property_path : String, invalid_value : AVD::Container) #

[View source]

Instance Method Detail

def add : Nil #

Adds the violation to the current AVD::ExecutionContextInterface.


[View source]
def add_parameter(key : String, value : _) : AVD::Violation::ConstraintViolationBuilderInterface #

Adds a parameter with the provided key and value to the violations' AVD::Violation::ConstraintViolationInterface#parameters. The provided value is stringified via #to_s before being added to the parameters.

Returns self for chaining.


[View source]

Sets the AVD::Violation::ConstraintViolationInterface#property_path.

Returns self for chaining.


[View source]
def cause(cause : String | Nil) : AVD::Violation::ConstraintViolationBuilderInterface #

Sets the AVD::Violation::ConstraintViolationInterface#cause

Returns self for chaining.


[View source]
def code(code : String | Nil) : AVD::Violation::ConstraintViolationBuilderInterface #

Sets the AVD::Violation::ConstraintViolationInterface#code

Returns self for chaining.


[View source]

Sets the AVD::Violation::ConstraintViolationInterface#constraint

Returns self for chaining.


[View source]

[View source]

Sets AVD::Violation::ConstraintViolationInterface#plural

Returns self for chaining.


[View source]
def set_parameters(parameters : Hash(String, String)) : AVD::Violation::ConstraintViolationBuilderInterface #

Overrides the entire AVD::Violation::ConstraintViolationInterface#parameters hash with the provided parameters.

Returns self for chaining.


[View source]