fakeit 0.6.0 → 0.6.1

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: '08e498097efdfb3a803d5fcafc2f755b37f74ade0b0d409ba9ea36cd0ffbc0fd'
4
- data.tar.gz: 77abcf6e9aa8db912d6b6a158a2cc8a95bbced90311617692e1f67f99e1d7249
3
+ metadata.gz: 59bece2543ccaf7906abc84fc93b4b00052f66a1eb4ba4b203b68316aa622c54
4
+ data.tar.gz: 9707b83a083a2005bf79794bf92b88d377c768d859cd77c71fa4b987f88846b0
5
5
  SHA512:
6
- metadata.gz: cce0c415a9e2fb40b9b55178dd9b85b8b8f643453ab3e3d4a2203269af0ca7650adca35b464c30f7e82c3b29e8f2319ff1a8543ee8f3d0f793dfa28945f038f5
7
- data.tar.gz: ac9ca06debd2181ee4332edbd30e7a3413f1cf4caeec7981340c6189258615411928364836601b8772be3d8efa87dd72e69e18870b8bd1e0c5dbcf3eb5ee821c
6
+ metadata.gz: 42e43ec523c1ca862793d771bcf0c7eefa2cbf82711d95fd731fff10c011a151d37e6f59ee4df030a27432a392b4d210f23143711bc1dca5af15a64989ee684b
7
+ data.tar.gz: 32817be7cb3bc2eca9749a503a2ccbee8b955caafaf93fe0a338a91473320993935507efbafe02ea96e493f4a9af435f028711460c6dd96510078caaa040ad10
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fakeit (0.6.0)
4
+ fakeit (0.6.1)
5
5
  faker (= 2.11.0)
6
6
  openapi_parser (= 0.8.0)
7
7
  rack (~> 2.0)
@@ -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|
@@ -16,7 +16,7 @@ module Fakeit
16
16
  private
17
17
 
18
18
  def parse_json(body)
19
- JSON.parse(body)
19
+ body.empty? ? {} : JSON.parse(body)
20
20
  rescue StandardError
21
21
  raise Fakeit::Validation::ValidationError, 'Invalid json payload'
22
22
  end
@@ -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, -> { min_array })
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 ? unique_array_size : Faker::Number.between(from: min_array, to: max_array(example_options[:depth]))
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 unique_array_size
44
+ def non_empty_size
45
45
  [min_array, 1].max
46
46
  end
47
47
 
@@ -1,3 +1,3 @@
1
1
  module Fakeit
2
- VERSION = '0.6.0'.freeze
2
+ VERSION = '0.6.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fakeit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Feng