Module: JSON::SchemaBuilder

Extended by:
ActiveSupport::Concern, Configuration
Includes:
DSL
Defined in:
lib/json/schema_builder.rb,
lib/json/schema_builder/dsl.rb,
lib/json/schema_builder/null.rb,
lib/json/schema_builder/array.rb,
lib/json/schema_builder/entity.rb,
lib/json/schema_builder/number.rb,
lib/json/schema_builder/object.rb,
lib/json/schema_builder/schema.rb,
lib/json/schema_builder/string.rb,
lib/json/schema_builder/boolean.rb,
lib/json/schema_builder/integer.rb,
lib/json/schema_builder/numeric.rb,
lib/json/schema_builder/version.rb,
lib/json/schema_builder/attribute.rb,
lib/json/schema_builder/validation.rb,
lib/json/schema_builder/configuration.rb,
lib/json/schema_builder/rspec_helper/rspec_helper.rb,
lib/json/schema_builder/rspec_helper/deep_open_struct.rb

Defined Under Namespace

Modules: Attribute, ClassMethods, Configuration, DSL, RSpecHelper, Validation Classes: Array, Boolean, Entity, Integer, Null, Number, Numeric, Object, Schema, String

Constant Summary collapse

VERSION =
'0.0.4'

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Configuration

configure, options, options=

Methods included from DSL

#entity

Class Method Details

.default_optionsObject



24
25
26
# File 'lib/json/schema_builder.rb', line 24

def self.default_options
  @options || { }
end

Instance Method Details

#initialize(context = { }) ⇒ Object



28
29
30
31
32
# File 'lib/json/schema_builder.rb', line 28

def initialize(context = { })
  context.each_pair do |key, value|
    instance_variable_set "@#{ key }", value
  end
end

#root(key = nil, &block) ⇒ Object



34
35
36
37
38
39
# File 'lib/json/schema_builder.rb', line 34

def root(key = nil, &block)
  root_key = key || self.class.root_key.to_sym
  object do
    object root_key, required: true, &block
  end
end