genny 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/VERSION +1 -1
- data/lib/genny/json_schema.rb +9 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZDUwYjhjNDY5MmZlYmIwYjZmMTYzNTU5MzQyOWQxOWM4YzdhZjA3YQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZGE2ZjhmYjhmMGZiMjcyNDFmZTEwNTUwNTRjZGQ4NmEwZWJhNDgxNA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ZDI1MjVkNTNjMDNmMzQxMDdmMTZkOTU4NzhlN2UyYjcwZDlkZTBiNmQ0Mjdk
|
10
|
+
MWE5YzE2OGU0NmJjNGM0Yjc4MjU1MmFkMzkwYjAzY2MxNDI4NGNlYTRkMGQ4
|
11
|
+
ZTFjMmJjOWU4NDI2OTAyYTc2Njg2YThkYzYxMzNmZDI2YWY2ZTk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NGFkY2I0ZTVkMWIwYjEyZWYxNGZhNjNjMmRlZDVkNTc0OWY0OWMxZGY2ZjBl
|
14
|
+
ODZmNWRhNjY5MTE5YWM0NWQ1YWRkODU1ODAxNDQxYzE2MjAyMWJhN2YwYWQx
|
15
|
+
MGMzYTI0NDhiODhlYjAyZWU2MmQ2MDllYzIyMWRhMGUwZjQ1ZjY=
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/lib/genny/json_schema.rb
CHANGED
@@ -71,7 +71,15 @@ module Genny
|
|
71
71
|
|
72
72
|
def self.genny(opts = {})
|
73
73
|
opts = Genny.symbolize(opts)
|
74
|
-
|
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,
|