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 +4 -4
- data/README.md +9 -9
- data/lib/jsonschema/generator/draft07.rb +6 -6
- data/lib/jsonschema/generator/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b30dcc6771904bbd512f87b075082bc0a854057a5fd1386e3db085c97a52b3d0
|
4
|
+
data.tar.gz: 52730cfee888c5e8e82c518a3e16b847cfa93f180429d9599efbec1dbcdfb5da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
#
|
40
|
-
#
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
#
|
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 = {
|
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)])
|
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.
|
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-
|
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.
|
171
|
+
rubygems_version: 3.0.1
|
172
172
|
signing_key:
|
173
173
|
specification_version: 4
|
174
174
|
summary: Generate JSON schema from JSON.
|