module JSON::SchemaBuilder

Constants

VERSION

Attributes

root_key[RW]

Public Class Methods

default_options() click to toggle source
# File lib/json/schema_builder.rb, line 25
def self.default_options
  @options || { }
end
new(context = { }) click to toggle source
# File lib/json/schema_builder.rb, line 29
def initialize(context = { })
  context.each_pair do |key, value|
    instance_variable_set "@#{ key }", value
  end
end

Public Instance Methods

root(key = nil, &block) click to toggle source
# File lib/json/schema_builder.rb, line 35
def root(key = nil, &block)
  root_key = key || self.class.root_key.to_sym
  object do
    object root_key, required: true, &block
  end
end