fakeit 0.6.0 → 0.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/docs/static.md +1 -1
- data/lib/fakeit/app/body_parser.rb +1 -1
- data/lib/fakeit/openapi/example/array_example.rb +3 -3
- data/lib/fakeit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 59bece2543ccaf7906abc84fc93b4b00052f66a1eb4ba4b203b68316aa622c54
|
4
|
+
data.tar.gz: 9707b83a083a2005bf79794bf92b88d377c768d859cd77c71fa4b987f88846b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42e43ec523c1ca862793d771bcf0c7eefa2cbf82711d95fd731fff10c011a151d37e6f59ee4df030a27432a392b4d210f23143711bc1dca5af15a64989ee684b
|
7
|
+
data.tar.gz: 32817be7cb3bc2eca9749a503a2ccbee8b955caafaf93fe0a338a91473320993935507efbafe02ea96e493f4a9af435f028711460c6dd96510078caaa040ad10
|
data/Gemfile.lock
CHANGED
data/docs/static.md
CHANGED
@@ -8,7 +8,7 @@ Static value generation rule
|
|
8
8
|
| |anyOf|same as allOf|
|
9
9
|
|boolean|N/A|`true`|
|
10
10
|
|array|N/A|size is `1`|
|
11
|
-
| |minItems|size is minItems|
|
11
|
+
| |minItems|size is max(minItems,1)|
|
12
12
|
|string|N/A|`string`|
|
13
13
|
| |enum|first item|
|
14
14
|
| |pattern|Generated but always the same|
|
@@ -4,7 +4,7 @@ module Fakeit
|
|
4
4
|
def array_example(options)
|
5
5
|
example_options = add_depth(options)
|
6
6
|
if example_options[:use_static][type: 'array', property: example_options[:property]]
|
7
|
-
generate_array_example(example_options, -> {
|
7
|
+
generate_array_example(example_options, -> { non_empty_size })
|
8
8
|
else
|
9
9
|
generate_array_example(example_options, -> { random_array_size(example_options) })
|
10
10
|
end
|
@@ -18,7 +18,7 @@ module Fakeit
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def random_array_size(example_options)
|
21
|
-
uniqueItems ?
|
21
|
+
uniqueItems ? non_empty_size : Faker::Number.between(from: min_array, to: max_array(example_options[:depth]))
|
22
22
|
end
|
23
23
|
|
24
24
|
def generate_items(size, retries, example_options, result)
|
@@ -41,7 +41,7 @@ module Fakeit
|
|
41
41
|
uniqueItems && result.include?(item) && retries.positive?
|
42
42
|
end
|
43
43
|
|
44
|
-
def
|
44
|
+
def non_empty_size
|
45
45
|
[min_array, 1].max
|
46
46
|
end
|
47
47
|
|
data/lib/fakeit/version.rb
CHANGED