class CrSerializer::Validator

Defined in:

CrSerializer/validator.cr

Constructors

Instance Method Summary

Instance methods inherited from class Object

to_json(io : IO, groups : Array(String), expand : Array(String))
to_json(groups : Array(String) = ["default"], expand : Array(String) = [] of String) : String
to_json
, to_pretty_json(indent : String = " ", groups : Array(String) = ["default"], expand : Array(String) = [] of String)
to_pretty_json(io : IO, groups : Array(String), expand : Array(String), indent : String = " ")
to_pretty_json
, to_yaml(groups : Array(String) = ["default"], expand : Array(String) = [] of String) : String to_yaml

Constructor Detail

def self.new(assertions : Array(CrSerializer::Assertions::Assertion) = [] of CrSerializer::Assertions::Assertion) #

Runs the given array of assertions upon initialization. Errors are cached to prevent assertions running multiple times


[View source]

Instance Method Detail

def assertions : Array(CrSerializer::Assertions::Assertion) #

Array of assertions defined on self


[View source]
def errors : Array(String) #

Array of errors as to why the object is not valid


[View source]
def invalid_properties : Array(String) #

Returns the properties that failed their assertions


[View source]
def valid? : Bool #

Returns true if there were no failed assertions, otherwise false


[View source]