class JSONSchema::NumberValidator

Overview

Validates schema where the type is number or integer.

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 enum_list : Array(JSON::Any) #

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

[View source]
def exclusive_maximum : Int32 | Nil #

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

[View source]
def exclusive_minimum : Int32 | Nil #

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

[View source]
def has_integer_constraint : Bool #

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

[View source]
def maximum : Int32 | Nil #

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

[View source]
def minimum : Int32 | Nil #

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

[View source]
def multiple_of : Int32 | Nil #

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

[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.integer do
  minimum 0
end

validator.to_json # => {"type":"number","minimum":0}

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

[View source]