fakeit 0.6.2 → 0.8.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: 2f19c0713bc918d394d2bb1c56251b09cf6dae231a0252c5bbb32c3b99fd284d
4
- data.tar.gz: abcb565c1179594b5ea2b5c2f707c4c3597fbb74e2833edeb5335661866723a0
3
+ metadata.gz: b596171f4bdda96b6782f7292abbadee787e56f045d75449792f64c86b370abf
4
+ data.tar.gz: f9d429ed7328142a0b7f53e3352d782bf5b096ce449e88ada902b6205b916010
5
5
  SHA512:
6
- metadata.gz: 962926947343492b3b37a5e1739d8919cc76ffac8491e033e183f72a8ac2346eb62147aed3e870da9dfc8988422c9f0869255d7957253bb56fc0f35772e8065a
7
- data.tar.gz: d471fae5943b4932e07413ee8f67ba484f188efddb0a5d4bf8198f0d791eea07e9744514e7b6ef0890be5dd4932a088bd4f9cc60111f9c72adfadfd96af5fb44
6
+ metadata.gz: 9ee0a08eae71abb26ee679615022fe3eb363e90233714f0eb34bccca973a1d68dbc16badcd0520456a30fc7e0966df7405bb551e27664c101fea8482ce3d78d6
7
+ data.tar.gz: de08d3b1e0f0118c85bc61d8e22d812ac591a439dace0a7dc5279a9801d21a50cdf1f6f8baf6378e35487ac9ba565e30630e949e179ec2e10f8f3092e4df1840
data/.circleci/config.yml CHANGED
@@ -12,7 +12,7 @@ jobs:
12
12
 
13
13
  docker:
14
14
  # specify the version you desire here
15
- - image: circleci/ruby:2.7.0
15
+ - image: circleci/ruby:3.0.0
16
16
 
17
17
  # Specify service dependencies here if necessary
18
18
  # CircleCI maintains a library of pre-built images
data/.rubocop.yml CHANGED
@@ -1,5 +1,6 @@
1
1
  AllCops:
2
- TargetRubyVersion: 2.7
2
+ TargetRubyVersion: 3.0
3
+ NewCops: enable
3
4
 
4
5
  Style/Documentation:
5
6
  Enabled: false
@@ -18,53 +19,5 @@ Metrics/BlockLength:
18
19
  Security/Open:
19
20
  Enabled: false
20
21
 
21
- Style/HashEachMethods:
22
- Enabled: true
23
-
24
22
  Style/HashTransformKeys:
25
23
  Enabled: false
26
-
27
- Style/HashTransformValues:
28
- Enabled: true
29
-
30
- Lint/RaiseException:
31
- Enabled: true
32
-
33
- Lint/StructNewOverride:
34
- Enabled: true
35
-
36
- Layout/EmptyLinesAroundAttributeAccessor:
37
- Enabled: true
38
-
39
- Layout/SpaceAroundMethodCallOperator:
40
- Enabled: true
41
-
42
- Lint/DeprecatedOpenSSLConstant:
43
- Enabled: true
44
-
45
- Lint/MixedRegexpCaptureTypes:
46
- Enabled: true
47
-
48
- Style/AccessorGrouping:
49
- Enabled: true
50
-
51
- Style/BisectedAttrAccessor:
52
- Enabled: true
53
-
54
- Style/ExponentialNotation:
55
- Enabled: true
56
-
57
- Style/RedundantAssignment:
58
- Enabled: true
59
-
60
- Style/RedundantFetchBlock:
61
- Enabled: true
62
-
63
- Style/RedundantRegexpCharacterClass:
64
- Enabled: true
65
-
66
- Style/RedundantRegexpEscape:
67
- Enabled: true
68
-
69
- Style/SlicingWithRange:
70
- Enabled: true
data/CHANGELOG.md ADDED
@@ -0,0 +1,176 @@
1
+ # Changelog
2
+
3
+ ## [v0.8.0](https://github.com/JustinFeng/fakeit/tree/v0.8.0) (2021-02-27)
4
+
5
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.7.1...v0.8.0)
6
+
7
+ **Implemented enhancements:**
8
+
9
+ - Upgraded to ruby 3.0.0
10
+
11
+ ## [v0.7.1](https://github.com/JustinFeng/fakeit/tree/v0.7.1) (2021-02-07)
12
+
13
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.7.0...v0.7.1)
14
+
15
+ **Fixed bugs:**
16
+
17
+ - ERROR NoMethodError: undefined method `to\_example' for \# [\#20](https://github.com/JustinFeng/fakeit/issues/20)
18
+
19
+ ## [v0.7.0](https://github.com/JustinFeng/fakeit/tree/v0.7.0) (2020-10-22)
20
+
21
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.6.3...v0.7.0)
22
+
23
+ **Implemented enhancements:**
24
+
25
+ - Supported change mock server behaviour on the fly
26
+ - Allowed to redirect console log to a file
27
+
28
+ ## [v0.6.3](https://github.com/JustinFeng/fakeit/tree/v0.6.3) (2020-09-11)
29
+
30
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.6.2...v0.6.3)
31
+
32
+ **Implemented enhancements:**
33
+
34
+ - Enhanced regex example generation
35
+
36
+ ## [v0.6.2](https://github.com/JustinFeng/fakeit/tree/v0.6.2) (2020-07-12)
37
+
38
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.6.1...v0.6.2)
39
+
40
+ ## [v0.6.1](https://github.com/JustinFeng/fakeit/tree/v0.6.1) (2020-05-02)
41
+
42
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.6.0...v0.6.1)
43
+
44
+ ## [v0.6.0](https://github.com/JustinFeng/fakeit/tree/v0.6.0) (2020-05-02)
45
+
46
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.5.3...v0.6.0)
47
+
48
+ **Implemented enhancements:**
49
+
50
+ - Added support for multipart/form-data validation
51
+
52
+ **Fixed bugs:**
53
+
54
+ - Multipart request contain special character will respond 500 [\#16](https://github.com/JustinFeng/fakeit/issues/16)
55
+
56
+ ## [v0.5.3](https://github.com/JustinFeng/fakeit/tree/v0.5.3) (2020-04-05)
57
+
58
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.5.2...v0.5.3)
59
+
60
+ ## [v0.5.2](https://github.com/JustinFeng/fakeit/tree/v0.5.2) (2020-04-03)
61
+
62
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.5.1...v0.5.2)
63
+
64
+ ## [v0.5.1](https://github.com/JustinFeng/fakeit/tree/v0.5.1) (2020-04-03)
65
+
66
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.5.0...v0.5.1)
67
+
68
+ ## [v0.5.0](https://github.com/JustinFeng/fakeit/tree/v0.5.0) (2020-04-03)
69
+
70
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.4.2...v0.5.0)
71
+
72
+ **Merged pull requests:**
73
+
74
+ - Bump rack from 2.0.7 to 2.0.8 [\#18](https://github.com/JustinFeng/fakeit/pull/18) ([dependabot[bot]](https://github.com/apps/dependabot))
75
+
76
+ ## [v0.4.2](https://github.com/JustinFeng/fakeit/tree/v0.4.2) (2019-11-22)
77
+
78
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.4.1...v0.4.2)
79
+
80
+ ## [v0.4.1](https://github.com/JustinFeng/fakeit/tree/v0.4.1) (2019-11-21)
81
+
82
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.4.0...v0.4.1)
83
+
84
+ **Merged pull requests:**
85
+
86
+ - Bump rack-cors from 1.0.3 to 1.0.6 [\#17](https://github.com/JustinFeng/fakeit/pull/17) ([dependabot[bot]](https://github.com/apps/dependabot))
87
+
88
+ ## [v0.4.0](https://github.com/JustinFeng/fakeit/tree/v0.4.0) (2019-10-09)
89
+
90
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.3.1...v0.4.0)
91
+
92
+ **Implemented enhancements:**
93
+
94
+ - Implement support for watching for changes in spec/yaml file. [\#15](https://github.com/JustinFeng/fakeit/issues/15)
95
+
96
+ ## [v0.3.1](https://github.com/JustinFeng/fakeit/tree/v0.3.1) (2019-09-01)
97
+
98
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.3.0...v0.3.1)
99
+
100
+ ## [v0.3.0](https://github.com/JustinFeng/fakeit/tree/v0.3.0) (2019-08-27)
101
+
102
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.2.1...v0.3.0)
103
+
104
+ **Closed issues:**
105
+
106
+ - Missing "motivation" section in readme [\#14](https://github.com/JustinFeng/fakeit/issues/14)
107
+
108
+ ## [v0.2.1](https://github.com/JustinFeng/fakeit/tree/v0.2.1) (2019-08-04)
109
+
110
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.2.0...v0.2.1)
111
+
112
+ **Implemented enhancements:**
113
+
114
+ - Support .yaml files [\#9](https://github.com/JustinFeng/fakeit/issues/9)
115
+
116
+ **Fixed bugs:**
117
+
118
+ - Adjust integer generation bounds [\#12](https://github.com/JustinFeng/fakeit/issues/12)
119
+
120
+ **Closed issues:**
121
+
122
+ - End to End Tests [\#8](https://github.com/JustinFeng/fakeit/issues/8)
123
+
124
+ **Merged pull requests:**
125
+
126
+ - support .yaml files [\#10](https://github.com/JustinFeng/fakeit/pull/10) ([monsterkrampe](https://github.com/monsterkrampe))
127
+
128
+ ## [v0.2.0](https://github.com/JustinFeng/fakeit/tree/v0.2.0) (2019-07-17)
129
+
130
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.1.5...v0.2.0)
131
+
132
+ **Implemented enhancements:**
133
+
134
+ - Generate more array elements with performance considered [\#7](https://github.com/JustinFeng/fakeit/issues/7)
135
+ - Non random response [\#5](https://github.com/JustinFeng/fakeit/issues/5)
136
+
137
+ **Fixed bugs:**
138
+
139
+ - Invalid example for number type with more than 2 decimal places 'multipleOf' [\#6](https://github.com/JustinFeng/fakeit/issues/6)
140
+
141
+ ## [v0.1.5](https://github.com/JustinFeng/fakeit/tree/v0.1.5) (2019-06-28)
142
+
143
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.1.4...v0.1.5)
144
+
145
+ **Implemented enhancements:**
146
+
147
+ - Allow CORS [\#4](https://github.com/JustinFeng/fakeit/pull/4) ([monsterkrampe](https://github.com/monsterkrampe))
148
+
149
+ ## [v0.1.4](https://github.com/JustinFeng/fakeit/tree/v0.1.4) (2019-06-25)
150
+
151
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.1.3...v0.1.4)
152
+
153
+ **Implemented enhancements:**
154
+
155
+ - W, \[2019-06-25T03:00:29.635993 \#1\] WARN -- : Unknown string format: guid [\#2](https://github.com/JustinFeng/fakeit/issues/2)
156
+
157
+ **Fixed bugs:**
158
+
159
+ - Request not completing [\#3](https://github.com/JustinFeng/fakeit/issues/3)
160
+ - Stack level too deep in docker container [\#1](https://github.com/JustinFeng/fakeit/issues/1)
161
+
162
+ ## [v0.1.3](https://github.com/JustinFeng/fakeit/tree/v0.1.3) (2019-06-16)
163
+
164
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.1.2...v0.1.3)
165
+
166
+ ## [v0.1.2](https://github.com/JustinFeng/fakeit/tree/v0.1.2) (2019-06-05)
167
+
168
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.1.1...v0.1.2)
169
+
170
+ ## [v0.1.1](https://github.com/JustinFeng/fakeit/tree/v0.1.1) (2019-05-26)
171
+
172
+ [Full Changelog](https://github.com/JustinFeng/fakeit/compare/4f94874eaf87300496e9de632cd659a031cb3ce2...v0.1.1)
173
+
174
+
175
+
176
+ \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/Gemfile.lock CHANGED
@@ -1,29 +1,31 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fakeit (0.6.2)
4
+ fakeit (0.8.1)
5
5
  faker (= 2.13.0)
6
- openapi_parser (= 0.11.2)
6
+ openapi_parser (= 0.12.1)
7
7
  rack (~> 2.0)
8
8
  rack-cors (~> 1.0)
9
9
  rainbow (~> 3.0)
10
+ regexp-examples (= 1.5.1)
10
11
  slop (~> 4.8)
12
+ webrick (~> 1.7)
11
13
 
12
14
  GEM
13
15
  remote: https://rubygems.org/
14
16
  specs:
15
- ast (2.4.1)
17
+ ast (2.4.2)
16
18
  byebug (11.1.3)
17
- concurrent-ruby (1.1.6)
19
+ concurrent-ruby (1.1.8)
18
20
  diff-lcs (1.4.4)
19
- docile (1.3.2)
21
+ docile (1.3.5)
20
22
  faker (2.13.0)
21
23
  i18n (>= 1.6, < 2)
22
- i18n (1.8.3)
24
+ i18n (1.8.9)
23
25
  concurrent-ruby (~> 1.0)
24
- openapi_parser (0.11.2)
25
- parallel (1.19.2)
26
- parser (2.7.1.4)
26
+ openapi_parser (0.12.1)
27
+ parallel (1.20.1)
28
+ parser (3.0.0.0)
27
29
  ast (~> 2.4.1)
28
30
  rack (2.2.3)
29
31
  rack-cors (1.1.1)
@@ -31,40 +33,46 @@ GEM
31
33
  rack-test (1.1.0)
32
34
  rack (>= 1.0, < 3)
33
35
  rainbow (3.0.0)
34
- rake (12.3.3)
35
- regexp_parser (1.7.1)
36
+ rake (13.0.3)
37
+ regexp-examples (1.5.1)
38
+ regexp_parser (2.1.1)
36
39
  rexml (3.2.4)
37
- rspec (3.9.0)
38
- rspec-core (~> 3.9.0)
39
- rspec-expectations (~> 3.9.0)
40
- rspec-mocks (~> 3.9.0)
41
- rspec-core (3.9.2)
42
- rspec-support (~> 3.9.3)
43
- rspec-expectations (3.9.2)
40
+ rspec (3.10.0)
41
+ rspec-core (~> 3.10.0)
42
+ rspec-expectations (~> 3.10.0)
43
+ rspec-mocks (~> 3.10.0)
44
+ rspec-core (3.10.1)
45
+ rspec-support (~> 3.10.0)
46
+ rspec-expectations (3.10.1)
44
47
  diff-lcs (>= 1.2.0, < 2.0)
45
- rspec-support (~> 3.9.0)
46
- rspec-mocks (3.9.1)
48
+ rspec-support (~> 3.10.0)
49
+ rspec-mocks (3.10.2)
47
50
  diff-lcs (>= 1.2.0, < 2.0)
48
- rspec-support (~> 3.9.0)
49
- rspec-support (3.9.3)
50
- rubocop (0.87.1)
51
+ rspec-support (~> 3.10.0)
52
+ rspec-support (3.10.2)
53
+ rubocop (1.10.0)
51
54
  parallel (~> 1.10)
52
- parser (>= 2.7.1.1)
55
+ parser (>= 3.0.0.0)
53
56
  rainbow (>= 2.2.2, < 4.0)
54
- regexp_parser (>= 1.7)
57
+ regexp_parser (>= 1.8, < 3.0)
55
58
  rexml
56
- rubocop-ast (>= 0.1.0, < 1.0)
59
+ rubocop-ast (>= 1.2.0, < 2.0)
57
60
  ruby-progressbar (~> 1.7)
58
- unicode-display_width (>= 1.4.0, < 2.0)
59
- rubocop-ast (0.1.0)
60
- parser (>= 2.7.0.1)
61
- ruby-progressbar (1.10.1)
62
- simplecov (0.18.5)
61
+ unicode-display_width (>= 1.4.0, < 3.0)
62
+ rubocop-ast (1.4.1)
63
+ parser (>= 2.7.1.5)
64
+ rubocop-rake (0.5.1)
65
+ rubocop
66
+ ruby-progressbar (1.11.0)
67
+ simplecov (0.21.2)
63
68
  docile (~> 1.1)
64
69
  simplecov-html (~> 0.11)
65
- simplecov-html (0.12.2)
70
+ simplecov_json_formatter (~> 0.1)
71
+ simplecov-html (0.12.3)
72
+ simplecov_json_formatter (0.1.2)
66
73
  slop (4.8.2)
67
- unicode-display_width (1.7.0)
74
+ unicode-display_width (2.0.0)
75
+ webrick (1.7.0)
68
76
 
69
77
  PLATFORMS
70
78
  ruby
@@ -74,10 +82,11 @@ DEPENDENCIES
74
82
  byebug (~> 11.0)
75
83
  fakeit!
76
84
  rack-test (~> 1.1)
77
- rake (~> 12.0)
85
+ rake (~> 13.0)
78
86
  rspec (~> 3.0)
79
- rubocop (~> 0.80)
87
+ rubocop (~> 1.10)
88
+ rubocop-rake (~> 0.5)
80
89
  simplecov (~> 0.18)
81
90
 
82
91
  BUNDLED WITH
83
- 2.1.2
92
+ 2.2.11
data/README.md CHANGED
@@ -48,13 +48,14 @@ Or use the [docker image](https://hub.docker.com/r/realfengjia/fakeit)
48
48
 
49
49
  $ fakeit --spec <Local file or remote url>
50
50
 
51
- Command line options:
51
+ ### Command line options
52
52
 
53
53
  $ fakeit --help
54
54
  usage:
55
55
  --spec spec file uri (required)
56
56
  -p, --port custom port
57
57
  -q, --quiet mute request and response log
58
+ -l, --log-file redirect log to a file
58
59
  --permissive log validation error as warning instead of denying request
59
60
  --use-example use example provided in spec if exists
60
61
  --static generate static response
@@ -65,6 +66,33 @@ Command line options:
65
66
  -v, --version
66
67
  -h, --help
67
68
 
69
+ ### Configuration endpoint
70
+
71
+ Mock server behaviour can be changed on the fly
72
+
73
+ Retrieve current config:
74
+
75
+ GET /__fakeit_config__
76
+
77
+ Update config:
78
+
79
+ PUT /__fakeit_config__
80
+
81
+ Request and response:
82
+ ```json
83
+ {
84
+ "permissive": false,
85
+ "use_example": true,
86
+ "static": false,
87
+ "static_types": [
88
+ "integer"
89
+ ],
90
+ "static_properties": [
91
+ "id"
92
+ ]
93
+ }
94
+ ```
95
+
68
96
  **Notes:**
69
97
  * See [here](docs/random.md) for Openapi properties supported in random response generation
70
98
  * See [here](docs/static.md) for default value in static response generation
data/bin/fakeit CHANGED
@@ -10,6 +10,7 @@ begin
10
10
  o.string '--spec', 'spec file uri (required)', required: true
11
11
  o.integer '-p', '--port', 'custom port'
12
12
  o.bool '-q', '--quiet', 'mute request and response log'
13
+ o.string '-l', '--log-file', 'redirect log to a file'
13
14
  o.bool '--permissive', 'log validation error as warning instead of denying request'
14
15
  o.bool '--use-example', 'use example provided in spec if exists'
15
16
  o.bool '--static', 'generate static response'
@@ -53,6 +54,9 @@ options = Fakeit::App::Options.new(
53
54
  )
54
55
  app = Fakeit.build(opts[:spec], options)
55
56
 
57
+ $stderr.reopen(File.new(opts[:log_file], File::WRONLY | File::TRUNC | File::CREAT)) if opts[:log_file]
58
+ $stderr.sync = true
59
+
56
60
  app.use Rack::Cors do
57
61
  allow do
58
62
  origins '*'