class JSONSchema::StringValidator

Overview

Validates schema where the type is string.

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 format : String? #

[View source]
def format=(format : String?) #

[View source]
def max_length : Int32? #

[View source]
def max_length=(max_length : Int32?) #

[View source]
def min_length : Int32? #

[View source]
def min_length=(min_length : Int32?) #

[View source]
def pattern : Regex? #

[View source]
def pattern=(pattern : Regex?) #

[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.string do
  min_length 10
end

validator.to_json # => {"type":"string","minLength":10}

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

[View source]