class JSONSchema::ArrayValidator

Overview

Validates schema where the type is array.

This is a raw Validator class that you most likely do not need to use directly. See the JSONSchema#create_validator macro, JSONSchema#from_json, or JSONSchema.fluent for common usage of this shard.

Included Modules

Defined in:

render.cr
serialize.cr
validator.cr

Instance Method Summary

Instance Method Detail

def composites : Array(CompositeValidator) #

[View source]
def composites=(composites : Array(CompositeValidator)) #

[View source]
def contains : Validator | Nil #

[View source]
def contains=(contains : Validator | Nil) #

[View source]
def enum_list : Array(JSON::Any) #

[View source]
def enum_list=(enum_list : Array(JSON::Any)) #

[View source]
def has_disabled_additional_items : Bool #

[View source]
def has_disabled_additional_items=(has_disabled_additional_items : Bool) #

[View source]
def items : Validator | Nil #

[View source]
def items=(items : Validator | Nil) #

[View source]
def max_contains : Int32 | Nil #

[View source]
def max_contains=(max_contains : Int32 | Nil) #

[View source]
def max_items : Int32 | Nil #

[View source]
def max_items=(max_items : Int32 | Nil) #

[View source]
def min_contains : Int32 | Nil #

[View source]
def min_contains=(min_contains : Int32 | Nil) #

[View source]
def min_items : Int32 | Nil #

[View source]
def min_items=(min_items : Int32 | Nil) #

[View source]
def prefix_items : Array(Validator) #

[View source]
def prefix_items=(prefix_items : Array(Validator)) #

[View source]
def to_cr #

[View source]
def to_json(json : JSON::Builder) #

Serialize the validator into its string representation.

js = JSONSchema.fluent

validator = js.array do
  items js.string
end

validator.to_json # => {"type":"array","items":{"type":"string"}}

[View source]
def unique_items : Bool #

[View source]
def unique_items=(unique_items : Bool) #

[View source]
def validate(node : JSON::Any, context = NodeContext.new) #

[View source]