class JSONSchema::NumberValidator
- JSONSchema::NumberValidator
- Reference
- Object
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.crserialize.cr
validator.cr
Instance Method Summary
- #composites : Array(CompositeValidator)
- #composites=(composites : Array(CompositeValidator))
- #enum_list : Array(JSON::Any)
- #enum_list=(enum_list : Array(JSON::Any))
- #exclusive_maximum : Int32 | Nil
- #exclusive_maximum=(exclusive_maximum : Int32 | Nil)
- #exclusive_minimum : Int32 | Nil
- #exclusive_minimum=(exclusive_minimum : Int32 | Nil)
- #has_integer_constraint : Bool
- #has_integer_constraint=(has_integer_constraint : Bool)
- #maximum : Int32 | Nil
- #maximum=(maximum : Int32 | Nil)
- #minimum : Int32 | Nil
- #minimum=(minimum : Int32 | Nil)
- #multiple_of : Int32 | Nil
- #multiple_of=(multiple_of : Int32 | Nil)
- #to_cr
-
#to_json(json : JSON::Builder)
Serialize the validator into its string representation.
- #validate(node : JSON::Any, context = NodeContext.new)
Instance Method Detail
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}