Class: Jsonschema::Generator::Draft07

Inherits:
Object
  • Object
show all
Defined in:
lib/jsonschema/generator/draft07.rb

Overview

Draft 07

Instance Method Summary collapse

Constructor Details

#initialize(raw_json, options = {}) ⇒ Draft07

Returns a new instance of Draft07.



9
10
11
12
13
# File 'lib/jsonschema/generator/draft07.rb', line 9

def initialize(raw_json, options = {})
  @raw_json = raw_json
  @options = options
  @parsed_json = parse(raw_json)
end

Instance Method Details

#callObject

Raises:



15
16
17
18
19
# File 'lib/jsonschema/generator/draft07.rb', line 15

def call
  raise Error, 'Invalid Input. JSON expected' unless parsed_json

  { 'title' => ROOT_TITLE }.merge(generate(parsed_json))
end