class JSONSchema::GenericValidator
- JSONSchema::GenericValidator
- Reference
- Object
Overview
Validates schema that has no type. Allows for constraints such as enum
, #const
or
composite schemas that do not require a type
keyword.
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))
- #const : JSON::Any | Nil
- #const=(const : JSON::Any | Nil)
- #enum_list : Array(JSON::Any)
- #enum_list=(enum_list : Array(JSON::Any))
- #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.generic do
const "test"
end
validator.to_json # => {"const":"test"}