jsonschema-generator 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 811f3625d6e17f8d01c93cb8d4f0457ab72cba33c2ebd5bb67dd86d38a86bfa6
4
- data.tar.gz: 786acd0acf2501618038d0c6cf7e3bcc5dac36b475de5aea4fdf56752634a0c0
3
+ metadata.gz: b30dcc6771904bbd512f87b075082bc0a854057a5fd1386e3db085c97a52b3d0
4
+ data.tar.gz: 52730cfee888c5e8e82c518a3e16b847cfa93f180429d9599efbec1dbcdfb5da
5
5
  SHA512:
6
- metadata.gz: a553e3e9023ee3cb1abfdbb15ff73ca5ea50cf330147cbfe6455c39e6149b48c9ecb977d096d19e08bf9378a38607260ea0982953c0d9ea4d08342160db0fd59
7
- data.tar.gz: f184a42bd01c721a236b0fbd72b46d94f7a7a98e0963a2c1758c3dbd29bfb76ca63935f3681d594375b7a1d2cadd7e29cc257154f2078048d9a846ae7822d8de
6
+ metadata.gz: 590722f57fdd8be9092c6a12a1e34b897075142a96a4e360e7bd8902c03496c2b0aaf024cd5da1f3886cf87c9452bcdb89e74800f44170420fc18256a7c3603b
7
+ data.tar.gz: 3d7e6ac9da493f64833fcbd56989c3d85f576fea7c1c5e4ee4b61c5499310710bebf882c0e6ae55a52eb1c62827736315d7f141ffa06377e6d4b6388018c4406
data/README.md CHANGED
@@ -36,15 +36,15 @@ Jsonschema::Generator::Draft07.new(input).call
36
36
  # 'title' => 'Root',
37
37
  # 'type' => 'object',
38
38
  # 'properties' => {
39
- # 'first' => {
40
- # 'type' => 'string',
41
- # },
42
- # 'second' => {
43
- # 'type' => 'integer',
44
- # },
45
- # 'third' => {
46
- # 'type' => 'string',
47
- # },
39
+ # 'first' => {
40
+ # 'type' => 'string',
41
+ # },
42
+ # 'second' => {
43
+ # 'type' => 'integer',
44
+ # },
45
+ # 'third' => {
46
+ # 'type' => 'string',
47
+ # },
48
48
  # },
49
49
  # 'required' => %w[first second third],
50
50
  # }
@@ -15,11 +15,7 @@ module Jsonschema
15
15
  def call
16
16
  raise Error, 'Invalid Input. JSON expected' unless parsed_json
17
17
 
18
- {
19
- 'title' => ROOT_TITLE,
20
- 'type' => 'object',
21
- 'required' => parsed_json.keys,
22
- }.merge(generate(parsed_json))
18
+ { 'title' => ROOT_TITLE }.merge(generate(parsed_json))
23
19
  end
24
20
 
25
21
  private
@@ -44,7 +40,11 @@ module Jsonschema
44
40
  end
45
41
 
46
42
  def generate_object(hash)
47
- params = { 'properties' => {}, 'type' => 'object' }
43
+ params = {
44
+ 'properties' => {},
45
+ 'type' => 'object',
46
+ 'required' => hash.keys,
47
+ }
48
48
 
49
49
  hash.each_with_object(params) do |(key, value), memo|
50
50
  memo['properties'].merge!(Hash[key, generate(value)])
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Jsonschema
4
4
  module Generator
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonschema-generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Bykov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-06-26 00:00:00.000000000 Z
11
+ date: 2019-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -168,7 +168,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
168
  - !ruby/object:Gem::Version
169
169
  version: '0'
170
170
  requirements: []
171
- rubygems_version: 3.0.3
171
+ rubygems_version: 3.0.1
172
172
  signing_key:
173
173
  specification_version: 4
174
174
  summary: Generate JSON schema from JSON.