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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fb5013ebaff6df3b177c3aa955acadd4d3ebb6f163effa1945482f43c6ef659c
4
- data.tar.gz: 300c9272d2771a22df0bc753b902597d2a45376bc9ba6d487dbed936c3d06ec1
3
+ metadata.gz: b477b7c6a66763298840118e09dbeee4c9324bc832eff1e07a790b1307f9309e
4
+ data.tar.gz: 4719a5ab55b54b7eeaf73368c91687a0c6c13f3000c8cab7e08b5103bf4f7e2d
5
5
  SHA512:
6
- metadata.gz: 31e72cb5f90d0db5460b396b0efca43164f2ce097e2cf9a5930fd20e8334e1595df3e6d1cf97a9636623d9653615d953d5cea8b8202f957ce0187ca760782687
7
- data.tar.gz: b7193dc88e2e8d5f8efdb2fff2a1e545556ad6c55a63b980345005a1a097d107fdb550c41ec6dcd69f777056a312910a9336b326d58b64334e114b62747ffdb5
6
+ metadata.gz: c7b08bca28d96506afba2998ffc0ff009d6e14ba7d0c145b7df7795236c92f39baa976f89261f24998da9fad85e6b2815b58474d8c09031f9e33437accedeb2c
7
+ data.tar.gz: 524736dea681839b8ff6da0a38b0229b5b5cecf235d34e50912fa91cc4d050683bc869ab9fbce6ee0d70ebc44619b266fab70113bc9f5b706c1dee7ba84081d9
data/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # CHANGELOG
2
+
3
+ ## 1.1.0
4
+
5
+ - scalar value block allowed
6
+
7
+ ## 1.0.0
8
+
9
+ - released
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.merge(@params)
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
 
@@ -2,7 +2,7 @@ module Json
2
2
  module Schema
3
3
  module Subset
4
4
  class DSL
5
- VERSION = "1.0.0".freeze
5
+ VERSION = "1.1.0".freeze
6
6
  end
7
7
  end
8
8
  end
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.0.0
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.0.0
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: