json-schema-subset-dsl 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/README.md +3 -0
- data/lib/json/schema/subset/dsl.rb +7 -7
- data/lib/json/schema/subset/dsl/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b477b7c6a66763298840118e09dbeee4c9324bc832eff1e07a790b1307f9309e
|
4
|
+
data.tar.gz: 4719a5ab55b54b7eeaf73368c91687a0c6c13f3000c8cab7e08b5103bf4f7e2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7b08bca28d96506afba2998ffc0ff009d6e14ba7d0c145b7df7795236c92f39baa976f89261f24998da9fad85e6b2815b58474d8c09031f9e33437accedeb2c
|
7
|
+
data.tar.gz: 524736dea681839b8ff6da0a38b0229b5b5cecf235d34e50912fa91cc4d050683bc869ab9fbce6ee0d70ebc44619b266fab70113bc9f5b706c1dee7ba84081d9
|
data/CHANGELOG.md
ADDED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Json::Schema::Subset::DSL
|
2
2
|
|
3
|
+
[![Actions Status](https://github.com/Narazaka/json-schema-subset-dsl/workflows/Ruby/badge.svg)](https://github.com/Narazaka/json-schema-subset-dsl/actions)
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/json-schema-subset-dsl.svg)](https://badge.fury.io/rb/json-schema-subset-dsl)
|
5
|
+
|
3
6
|
Yet another JSON Schema subset DSL.
|
4
7
|
|
5
8
|
Useful when writing a simple JSON schema.
|
@@ -25,14 +25,14 @@ module Json
|
|
25
25
|
ret = @schema.dup
|
26
26
|
ret["type"] = @type
|
27
27
|
ret["items"] = ret["items"].compile!
|
28
|
-
ret.merge(@params)
|
28
|
+
ret.merge(@params.map { |k, v| [k.to_s, v] }.to_h)
|
29
29
|
when Array(@type).include?("object")
|
30
30
|
required = @schema.keys - @optionals
|
31
31
|
ret = { "type" => @type, "properties" => @schema.map { |k, v| [k, v.compile!] }.to_h }
|
32
32
|
ret["required"] = required unless required.empty?
|
33
|
-
ret.merge(@params)
|
33
|
+
ret.merge(@params.map { |k, v| [k.to_s, v] }.to_h)
|
34
34
|
else
|
35
|
-
@schema.merge("type" => @type).map { |k, v| [k.to_s, v] }.to_h
|
35
|
+
@schema.merge("type" => @type).merge(@params).map { |k, v| [k.to_s, v] }.to_h
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
@@ -88,17 +88,17 @@ module Json
|
|
88
88
|
type = type.is_a?(Array) ? type.map(&:to_s) : type.to_s
|
89
89
|
case
|
90
90
|
when type == "ref"
|
91
|
-
@schema[name.to_s] = DSL.new(ref: args[1])
|
91
|
+
@schema[name.to_s] = DSL.new(ref: args[1], &block)
|
92
92
|
when type == "cref"
|
93
|
-
@schema[name.to_s] = DSL.new(ref: components!(args[1]))
|
93
|
+
@schema[name.to_s] = DSL.new(ref: components!(args[1]), &block)
|
94
94
|
when type == "dref"
|
95
|
-
@schema[name.to_s] = DSL.new(ref: definitions!(args[1]))
|
95
|
+
@schema[name.to_s] = DSL.new(ref: definitions!(args[1]), &block)
|
96
96
|
when Array(type).include?("array")
|
97
97
|
@schema[name.to_s] = DSL.new(type: type, params: opts, schema: { "items" => DSL.new(&block) })
|
98
98
|
when Array(type).include?("object")
|
99
99
|
@schema[name.to_s] = DSL.new(type: type, params: opts, &block)
|
100
100
|
else
|
101
|
-
@schema[name.to_s] = DSL.new(type: type, schema: opts)
|
101
|
+
@schema[name.to_s] = DSL.new(type: type, schema: opts, &block)
|
102
102
|
end
|
103
103
|
end
|
104
104
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: json-schema-subset-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Narazaka
|
@@ -164,6 +164,7 @@ files:
|
|
164
164
|
- ".rubocop.yml"
|
165
165
|
- ".rubocop_airbnb.yml"
|
166
166
|
- ".travis.yml"
|
167
|
+
- CHANGELOG.md
|
167
168
|
- Gemfile
|
168
169
|
- LICENSE
|
169
170
|
- README.md
|
@@ -181,7 +182,7 @@ metadata:
|
|
181
182
|
homepage_uri: https://github.com/Narazaka/json-schema-subset-dsl
|
182
183
|
source_code_uri: https://github.com/Narazaka/json-schema-subset-dsl.git
|
183
184
|
changelog_uri: https://github.com/Narazaka/json-schema-subset-dsl/blob/master/CHANGELOG.md
|
184
|
-
documentation_uri: https://www.rubydoc.info/gems/json-schema-subset-dsl/1.
|
185
|
+
documentation_uri: https://www.rubydoc.info/gems/json-schema-subset-dsl/1.1.0
|
185
186
|
post_install_message:
|
186
187
|
rdoc_options: []
|
187
188
|
require_paths:
|