json-schema_builder 0.8.1 → 0.8.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
  SHA1:
3
- metadata.gz: b4fe5462595486f84e355404b11e92a99f03a564
4
- data.tar.gz: 3f0940bd48c40ddf384e7456f6c47dab2a8b77ee
3
+ metadata.gz: 7f12a6684d1d6a4473cb6d639ae914d55e9a14e1
4
+ data.tar.gz: 12d20f46dc863f26ac108f99f8fa76e10c68c4b8
5
5
  SHA512:
6
- metadata.gz: b73789a2efa50e9780bcd9b2f88d84456ff74e02a380d25c69c01506e81d41195025583314407208fce6cfb6ea38542e0834cd7d2379f7b2482563f585a7ed5c
7
- data.tar.gz: 3b6a8c0bc16cd8561398682e6485802c3b839e7a3c7a6771b7bf29ca3a25a09ba19bc3eb50bc75a71178565ecacf5d755fb9b9e9c893c450ac581cf9338ef5e8
6
+ metadata.gz: 73e54fa0ab098ccbd5fe7f30de744c766517e58f59879d7af8e9264457c37629f62ed2af82c342eb76eed8a8fc640ef176e0a0d809305faf4a75d4f7ba9ebf29
7
+ data.tar.gz: 68d641015f025bd2302372503fabaecf71ec150c3aad7a4aa74414906ce0c18f3cfc3a5106f7fca4dae3401410ee46d7bf0d2ce0c1b76349f16b0b9e20886b34
@@ -82,7 +82,7 @@ module JSON
82
82
 
83
83
  def required=(*values)
84
84
  @parent.schema["required"] ||= []
85
- @parent.schema["required"] << @name
85
+ @parent.schema["required"] << @name if values.any?
86
86
  end
87
87
 
88
88
  def merge_children!
@@ -1,5 +1,5 @@
1
1
  module JSON
2
2
  module SchemaBuilder
3
- VERSION = '0.8.1'
3
+ VERSION = '0.8.2'
4
4
  end
5
5
  end
@@ -29,4 +29,16 @@ RSpec.describe JSON::SchemaBuilder::Object, type: :unit do
29
29
  its('pattern_properties'){ is_expected.to include '^_' => { 'type' => 'string' } }
30
30
  its('pattern_properties'){ is_expected.to include '^\.' => { 'type' => 'string' } }
31
31
  end
32
+
33
+ describe "#required" do
34
+ subject do
35
+ described_class.new 'name' do
36
+ string :test1, required: true
37
+ string :test2, required: false
38
+ string :test2, required: nil
39
+ end
40
+ end
41
+
42
+ its(:required) { is_expected.to match_array([:test1]) }
43
+ end
32
44
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json-schema_builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.1
4
+ version: 0.8.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Parrish
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-23 00:00:00.000000000 Z
11
+ date: 2018-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler