class JSONSchema::ObjectValidator
- JSONSchema::ObjectValidator
- Reference
- Object
Overview
Validates schema where the type
is object
.
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
- #additional_properties : Validator?
- #additional_properties=(additional_properties : Validator?)
- #composites : Array(CompositeValidator)
- #composites=(composites : Array(CompositeValidator))
- #dependent_required : Hash(String, Array(String))
- #dependent_required=(dependent_required : Hash(String, Array(String)))
- #dependent_schemas : Hash(String, ObjectValidator)
- #dependent_schemas=(dependent_schemas : Hash(String, ObjectValidator))
- #enum_list : Array(JSON::Any)
- #enum_list=(enum_list : Array(JSON::Any))
- #has_disabled_additional_properties : Bool
- #has_disabled_additional_properties=(has_disabled_additional_properties)
- #max_properties : Int32?
- #max_properties=(max_properties : Int32?)
- #min_properties : Int32?
- #min_properties=(min_properties : Int32?)
- #pattern_properties : Hash(Regex, Validator)
- #pattern_properties=(pattern_properties : Hash(Regex, Validator))
- #properties : Hash(String, Validator)
- #properties=(properties : Hash(String, Validator))
- #property_names : StringValidator?
- #property_names=(property_names : StringValidator?)
- #required : Array(String)?
- #required=(required : Array(String)?)
- #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.object do
prop "name", js.string
end
validator.to_json # => {"type":"object","properties":{"name":{"type":"string"}}}