genny 0.2.2 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +8 -8
  2. data/VERSION +1 -1
  3. data/lib/genny/json_schema.rb +9 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODA4NWZiM2YxMjk1OTE1ZjIzNDg4N2U3MmY1YTBjYjllZjk2ODg1Zg==
4
+ ZDUwYjhjNDY5MmZlYmIwYjZmMTYzNTU5MzQyOWQxOWM4YzdhZjA3YQ==
5
5
  data.tar.gz: !binary |-
6
- NGYzMDZkNzQyMzE1Y2I3OGZiZDFiNDgyZDk4YWUwNDU1MDQ1Yzg2NQ==
6
+ ZGE2ZjhmYjhmMGZiMjcyNDFmZTEwNTUwNTRjZGQ4NmEwZWJhNDgxNA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NGQ3OGVlOTA0ZTM4NzRhOTAyNTU5ZTRhZTMxZTZmNTc2ZThjY2Q1YWIzYzVk
10
- MDE3M2QxMGEwOTQ1YzdhMzdkYjNmZWI3NTM2YWRlYWM2MDBkMDU5NzRkYzYx
11
- NmFjMDFiMDNjMDYzZWY4Mjc3ZjNiZjM2OGFlYTBhN2EyYzUzZDQ=
9
+ ZDI1MjVkNTNjMDNmMzQxMDdmMTZkOTU4NzhlN2UyYjcwZDlkZTBiNmQ0Mjdk
10
+ MWE5YzE2OGU0NmJjNGM0Yjc4MjU1MmFkMzkwYjAzY2MxNDI4NGNlYTRkMGQ4
11
+ ZTFjMmJjOWU4NDI2OTAyYTc2Njg2YThkYzYxMzNmZDI2YWY2ZTk=
12
12
  data.tar.gz: !binary |-
13
- Nzk5OGNmMDdhYjIzMWI4MzYzMjljNjdjMWQ3NmZjNWExN2M0Yjc1Yjg0MDNm
14
- ZjFmM2RmNWY5MTU4NjBmZThiOGJlNDQwMTA2YjZiYmI1MzdmYmRjOTMxNjYy
15
- ZjY0YTg4YzU0ZjEwYWZmNzdjNDJmZTMyOWI3NDg4OTdjZjJkMmQ=
13
+ NGFkY2I0ZTVkMWIwYjEyZWYxNGZhNjNjMmRlZDVkNTc0OWY0OWMxZGY2ZjBl
14
+ ODZmNWRhNjY5MTE5YWM0NWQ1YWRkODU1ODAxNDQxYzE2MjAyMWJhN2YwYWQx
15
+ MGMzYTI0NDhiODhlYjAyZWU2MmQ2MDllYzIyMWRhMGUwZjQ1ZjY=
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.3.0
@@ -71,7 +71,15 @@ module Genny
71
71
 
72
72
  def self.genny(opts = {})
73
73
  opts = Genny.symbolize(opts)
74
- ::Hash[(opts[:properties] || {}).map { |key, schema_object|
74
+ opts[:additional_properties_n] ||= 3
75
+ raise "additional_properties_n must be an integer" unless opts[:additional_properties_n] >= 0
76
+ opts[:properties] ||= {}
77
+ if opts[:additionalProperties].is_a?(::Hash)
78
+ (opts[:additional_properties_n] * @@additional_properties).round.times do |i|
79
+ opts[:properties]["gennyAdditionalProperty#{i + 1}"] ||= opts[:additionalProperties]
80
+ end
81
+ end
82
+ ::Hash[opts[:properties].map { |key, schema_object|
75
83
  next nil if !(opts[:required] || []).include?(key) && Random.rand > @@additional_properties
76
84
  [
77
85
  key,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genny
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - JP Hastings-Spital