fakeit 0.6.1 → 0.8.0
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/.circleci/config.yml +1 -1
- data/.rubocop.yml +2 -13
- data/CHANGELOG.md +168 -0
- data/Gemfile.lock +52 -40
- data/README.md +31 -5
- data/bin/fakeit +4 -0
- data/docs/random.md +1 -1
- data/fakeit.gemspec +8 -5
- data/lib/fakeit.rb +3 -2
- data/lib/fakeit/app/app_builder.rb +23 -0
- data/lib/fakeit/app/helpers/body_parser.rb +32 -0
- data/lib/fakeit/app/helpers/response_builder.rb +19 -0
- data/lib/fakeit/app/options.rb +10 -0
- data/lib/fakeit/app/routes/config_route.rb +36 -0
- data/lib/fakeit/app/routes/openapi_route.rb +52 -0
- data/lib/fakeit/core_extensions/reference.rb +9 -0
- data/lib/fakeit/core_extensions/schema.rb +1 -3
- data/lib/fakeit/logger.rb +1 -2
- data/lib/fakeit/middleware/recorder.rb +2 -6
- data/lib/fakeit/openapi/example/array_example.rb +5 -15
- data/lib/fakeit/openapi/example/integer_example.rb +4 -12
- data/lib/fakeit/openapi/example/number_example.rb +6 -19
- data/lib/fakeit/openapi/example/string_example.rb +19 -23
- data/lib/fakeit/openapi/operation.rb +7 -21
- data/lib/fakeit/openapi/reference_error.rb +6 -0
- data/lib/fakeit/openapi/specification.rb +1 -1
- data/lib/fakeit/validation/validator.rb +4 -12
- data/lib/fakeit/version.rb +1 -1
- metadata +65 -19
- data/lib/fakeit/app/app.rb +0 -63
- data/lib/fakeit/app/body_parser.rb +0 -30
- data/lib/fakeit/core_extensions/findable.rb +0 -13
- data/lib/fakeit/core_extensions/path_item_finder.rb +0 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 285f5035e5fbd29cc124715beb4a901f63641eace09deda6b42a520222bc706c
|
|
4
|
+
data.tar.gz: 4dcacbd9adbfabdb80e265e740829afc920e9653563c047206197f39716336e6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 8b07445c0ddc4b8d21918b0ee6ede3108d1fcd01ff0babe8ae8aed1cc3686f4953d7ee0486247dd6f77195abafcd1a1584c44fe0a2e7030f24fba476883f256f
|
|
7
|
+
data.tar.gz: ecf3f4325a81c3ca550ff08f4738385ae9ae3d4de46bd32262dc58d303ac40f80ecd505ef29b411e59c25f360ca38c3f09c7839e75e538c33828d86b5872bef2
|
data/.circleci/config.yml
CHANGED
data/.rubocop.yml
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
AllCops:
|
|
2
|
-
TargetRubyVersion:
|
|
2
|
+
TargetRubyVersion: 3.0
|
|
3
|
+
NewCops: enable
|
|
3
4
|
|
|
4
5
|
Style/Documentation:
|
|
5
6
|
Enabled: false
|
|
@@ -18,17 +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
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [v0.7.1](https://github.com/JustinFeng/fakeit/tree/v0.7.1) (2021-02-07)
|
|
4
|
+
|
|
5
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.7.0...v0.7.1)
|
|
6
|
+
|
|
7
|
+
**Fixed bugs:**
|
|
8
|
+
|
|
9
|
+
- ERROR NoMethodError: undefined method `to\_example' for \# [\#20](https://github.com/JustinFeng/fakeit/issues/20)
|
|
10
|
+
|
|
11
|
+
## [v0.7.0](https://github.com/JustinFeng/fakeit/tree/v0.7.0) (2020-10-22)
|
|
12
|
+
|
|
13
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.6.3...v0.7.0)
|
|
14
|
+
|
|
15
|
+
**Implemented enhancements:**
|
|
16
|
+
|
|
17
|
+
- Supported change mock server behaviour on the fly
|
|
18
|
+
- Allowed to redirect console log to a file
|
|
19
|
+
|
|
20
|
+
## [v0.6.3](https://github.com/JustinFeng/fakeit/tree/v0.6.3) (2020-09-11)
|
|
21
|
+
|
|
22
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.6.2...v0.6.3)
|
|
23
|
+
|
|
24
|
+
**Implemented enhancements:**
|
|
25
|
+
|
|
26
|
+
- Enhanced regex example generation
|
|
27
|
+
|
|
28
|
+
## [v0.6.2](https://github.com/JustinFeng/fakeit/tree/v0.6.2) (2020-07-12)
|
|
29
|
+
|
|
30
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.6.1...v0.6.2)
|
|
31
|
+
|
|
32
|
+
## [v0.6.1](https://github.com/JustinFeng/fakeit/tree/v0.6.1) (2020-05-02)
|
|
33
|
+
|
|
34
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.6.0...v0.6.1)
|
|
35
|
+
|
|
36
|
+
## [v0.6.0](https://github.com/JustinFeng/fakeit/tree/v0.6.0) (2020-05-02)
|
|
37
|
+
|
|
38
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.5.3...v0.6.0)
|
|
39
|
+
|
|
40
|
+
**Implemented enhancements:**
|
|
41
|
+
|
|
42
|
+
- Added support for multipart/form-data validation
|
|
43
|
+
|
|
44
|
+
**Fixed bugs:**
|
|
45
|
+
|
|
46
|
+
- Multipart request contain special character will respond 500 [\#16](https://github.com/JustinFeng/fakeit/issues/16)
|
|
47
|
+
|
|
48
|
+
## [v0.5.3](https://github.com/JustinFeng/fakeit/tree/v0.5.3) (2020-04-05)
|
|
49
|
+
|
|
50
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.5.2...v0.5.3)
|
|
51
|
+
|
|
52
|
+
## [v0.5.2](https://github.com/JustinFeng/fakeit/tree/v0.5.2) (2020-04-03)
|
|
53
|
+
|
|
54
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.5.1...v0.5.2)
|
|
55
|
+
|
|
56
|
+
## [v0.5.1](https://github.com/JustinFeng/fakeit/tree/v0.5.1) (2020-04-03)
|
|
57
|
+
|
|
58
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.5.0...v0.5.1)
|
|
59
|
+
|
|
60
|
+
## [v0.5.0](https://github.com/JustinFeng/fakeit/tree/v0.5.0) (2020-04-03)
|
|
61
|
+
|
|
62
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.4.2...v0.5.0)
|
|
63
|
+
|
|
64
|
+
**Merged pull requests:**
|
|
65
|
+
|
|
66
|
+
- 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))
|
|
67
|
+
|
|
68
|
+
## [v0.4.2](https://github.com/JustinFeng/fakeit/tree/v0.4.2) (2019-11-22)
|
|
69
|
+
|
|
70
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.4.1...v0.4.2)
|
|
71
|
+
|
|
72
|
+
## [v0.4.1](https://github.com/JustinFeng/fakeit/tree/v0.4.1) (2019-11-21)
|
|
73
|
+
|
|
74
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.4.0...v0.4.1)
|
|
75
|
+
|
|
76
|
+
**Merged pull requests:**
|
|
77
|
+
|
|
78
|
+
- 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))
|
|
79
|
+
|
|
80
|
+
## [v0.4.0](https://github.com/JustinFeng/fakeit/tree/v0.4.0) (2019-10-09)
|
|
81
|
+
|
|
82
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.3.1...v0.4.0)
|
|
83
|
+
|
|
84
|
+
**Implemented enhancements:**
|
|
85
|
+
|
|
86
|
+
- Implement support for watching for changes in spec/yaml file. [\#15](https://github.com/JustinFeng/fakeit/issues/15)
|
|
87
|
+
|
|
88
|
+
## [v0.3.1](https://github.com/JustinFeng/fakeit/tree/v0.3.1) (2019-09-01)
|
|
89
|
+
|
|
90
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.3.0...v0.3.1)
|
|
91
|
+
|
|
92
|
+
## [v0.3.0](https://github.com/JustinFeng/fakeit/tree/v0.3.0) (2019-08-27)
|
|
93
|
+
|
|
94
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.2.1...v0.3.0)
|
|
95
|
+
|
|
96
|
+
**Closed issues:**
|
|
97
|
+
|
|
98
|
+
- Missing "motivation" section in readme [\#14](https://github.com/JustinFeng/fakeit/issues/14)
|
|
99
|
+
|
|
100
|
+
## [v0.2.1](https://github.com/JustinFeng/fakeit/tree/v0.2.1) (2019-08-04)
|
|
101
|
+
|
|
102
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.2.0...v0.2.1)
|
|
103
|
+
|
|
104
|
+
**Implemented enhancements:**
|
|
105
|
+
|
|
106
|
+
- Support .yaml files [\#9](https://github.com/JustinFeng/fakeit/issues/9)
|
|
107
|
+
|
|
108
|
+
**Fixed bugs:**
|
|
109
|
+
|
|
110
|
+
- Adjust integer generation bounds [\#12](https://github.com/JustinFeng/fakeit/issues/12)
|
|
111
|
+
|
|
112
|
+
**Closed issues:**
|
|
113
|
+
|
|
114
|
+
- End to End Tests [\#8](https://github.com/JustinFeng/fakeit/issues/8)
|
|
115
|
+
|
|
116
|
+
**Merged pull requests:**
|
|
117
|
+
|
|
118
|
+
- support .yaml files [\#10](https://github.com/JustinFeng/fakeit/pull/10) ([monsterkrampe](https://github.com/monsterkrampe))
|
|
119
|
+
|
|
120
|
+
## [v0.2.0](https://github.com/JustinFeng/fakeit/tree/v0.2.0) (2019-07-17)
|
|
121
|
+
|
|
122
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.1.5...v0.2.0)
|
|
123
|
+
|
|
124
|
+
**Implemented enhancements:**
|
|
125
|
+
|
|
126
|
+
- Generate more array elements with performance considered [\#7](https://github.com/JustinFeng/fakeit/issues/7)
|
|
127
|
+
- Non random response [\#5](https://github.com/JustinFeng/fakeit/issues/5)
|
|
128
|
+
|
|
129
|
+
**Fixed bugs:**
|
|
130
|
+
|
|
131
|
+
- Invalid example for number type with more than 2 decimal places 'multipleOf' [\#6](https://github.com/JustinFeng/fakeit/issues/6)
|
|
132
|
+
|
|
133
|
+
## [v0.1.5](https://github.com/JustinFeng/fakeit/tree/v0.1.5) (2019-06-28)
|
|
134
|
+
|
|
135
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.1.4...v0.1.5)
|
|
136
|
+
|
|
137
|
+
**Implemented enhancements:**
|
|
138
|
+
|
|
139
|
+
- Allow CORS [\#4](https://github.com/JustinFeng/fakeit/pull/4) ([monsterkrampe](https://github.com/monsterkrampe))
|
|
140
|
+
|
|
141
|
+
## [v0.1.4](https://github.com/JustinFeng/fakeit/tree/v0.1.4) (2019-06-25)
|
|
142
|
+
|
|
143
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.1.3...v0.1.4)
|
|
144
|
+
|
|
145
|
+
**Implemented enhancements:**
|
|
146
|
+
|
|
147
|
+
- W, \[2019-06-25T03:00:29.635993 \#1\] WARN -- : Unknown string format: guid [\#2](https://github.com/JustinFeng/fakeit/issues/2)
|
|
148
|
+
|
|
149
|
+
**Fixed bugs:**
|
|
150
|
+
|
|
151
|
+
- Request not completing [\#3](https://github.com/JustinFeng/fakeit/issues/3)
|
|
152
|
+
- Stack level too deep in docker container [\#1](https://github.com/JustinFeng/fakeit/issues/1)
|
|
153
|
+
|
|
154
|
+
## [v0.1.3](https://github.com/JustinFeng/fakeit/tree/v0.1.3) (2019-06-16)
|
|
155
|
+
|
|
156
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.1.2...v0.1.3)
|
|
157
|
+
|
|
158
|
+
## [v0.1.2](https://github.com/JustinFeng/fakeit/tree/v0.1.2) (2019-06-05)
|
|
159
|
+
|
|
160
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/v0.1.1...v0.1.2)
|
|
161
|
+
|
|
162
|
+
## [v0.1.1](https://github.com/JustinFeng/fakeit/tree/v0.1.1) (2019-05-26)
|
|
163
|
+
|
|
164
|
+
[Full Changelog](https://github.com/JustinFeng/fakeit/compare/4f94874eaf87300496e9de632cd659a031cb3ce2...v0.1.1)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/Gemfile.lock
CHANGED
|
@@ -1,67 +1,78 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
fakeit (0.
|
|
5
|
-
faker (= 2.
|
|
6
|
-
openapi_parser (= 0.
|
|
4
|
+
fakeit (0.8.0)
|
|
5
|
+
faker (= 2.13.0)
|
|
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.
|
|
16
|
-
byebug (11.1.
|
|
17
|
-
concurrent-ruby (1.1.
|
|
18
|
-
diff-lcs (1.
|
|
19
|
-
docile (1.3.
|
|
20
|
-
faker (2.
|
|
17
|
+
ast (2.4.2)
|
|
18
|
+
byebug (11.1.3)
|
|
19
|
+
concurrent-ruby (1.1.8)
|
|
20
|
+
diff-lcs (1.4.4)
|
|
21
|
+
docile (1.3.5)
|
|
22
|
+
faker (2.13.0)
|
|
21
23
|
i18n (>= 1.6, < 2)
|
|
22
|
-
i18n (1.8.
|
|
24
|
+
i18n (1.8.9)
|
|
23
25
|
concurrent-ruby (~> 1.0)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
rack (2.2.2)
|
|
26
|
+
openapi_parser (0.12.1)
|
|
27
|
+
parallel (1.20.1)
|
|
28
|
+
parser (3.0.0.0)
|
|
29
|
+
ast (~> 2.4.1)
|
|
30
|
+
rack (2.2.3)
|
|
30
31
|
rack-cors (1.1.1)
|
|
31
32
|
rack (>= 2.0.0)
|
|
32
33
|
rack-test (1.1.0)
|
|
33
34
|
rack (>= 1.0, < 3)
|
|
34
35
|
rainbow (3.0.0)
|
|
35
|
-
rake (
|
|
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.
|
|
38
|
-
rspec-core (~> 3.
|
|
39
|
-
rspec-expectations (~> 3.
|
|
40
|
-
rspec-mocks (~> 3.
|
|
41
|
-
rspec-core (3.
|
|
42
|
-
rspec-support (~> 3.
|
|
43
|
-
rspec-expectations (3.
|
|
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.
|
|
46
|
-
rspec-mocks (3.
|
|
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.
|
|
49
|
-
rspec-support (3.
|
|
50
|
-
rubocop (
|
|
51
|
-
jaro_winkler (~> 1.5.1)
|
|
51
|
+
rspec-support (~> 3.10.0)
|
|
52
|
+
rspec-support (3.10.2)
|
|
53
|
+
rubocop (1.10.0)
|
|
52
54
|
parallel (~> 1.10)
|
|
53
|
-
parser (>=
|
|
55
|
+
parser (>= 3.0.0.0)
|
|
54
56
|
rainbow (>= 2.2.2, < 4.0)
|
|
57
|
+
regexp_parser (>= 1.8, < 3.0)
|
|
55
58
|
rexml
|
|
59
|
+
rubocop-ast (>= 1.2.0, < 2.0)
|
|
56
60
|
ruby-progressbar (~> 1.7)
|
|
57
|
-
unicode-display_width (>= 1.4.0, <
|
|
58
|
-
|
|
59
|
-
|
|
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)
|
|
60
68
|
docile (~> 1.1)
|
|
61
69
|
simplecov-html (~> 0.11)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
simplecov_json_formatter (~> 0.1)
|
|
71
|
+
simplecov-html (0.12.3)
|
|
72
|
+
simplecov_json_formatter (0.1.2)
|
|
73
|
+
slop (4.8.2)
|
|
74
|
+
unicode-display_width (2.0.0)
|
|
75
|
+
webrick (1.7.0)
|
|
65
76
|
|
|
66
77
|
PLATFORMS
|
|
67
78
|
ruby
|
|
@@ -71,10 +82,11 @@ DEPENDENCIES
|
|
|
71
82
|
byebug (~> 11.0)
|
|
72
83
|
fakeit!
|
|
73
84
|
rack-test (~> 1.1)
|
|
74
|
-
rake (~>
|
|
85
|
+
rake (~> 13.0)
|
|
75
86
|
rspec (~> 3.0)
|
|
76
|
-
rubocop (~>
|
|
87
|
+
rubocop (~> 1.10)
|
|
88
|
+
rubocop-rake (~> 0.5)
|
|
77
89
|
simplecov (~> 0.18)
|
|
78
90
|
|
|
79
91
|
BUNDLED WITH
|
|
80
|
-
2.
|
|
92
|
+
2.2.11
|
data/README.md
CHANGED
|
@@ -30,14 +30,12 @@ After tried several existing options, we cannot find a best solution to meet all
|
|
|
30
30
|
|
|
31
31
|
## Features
|
|
32
32
|
|
|
33
|
-
* Randomly or statically generated response
|
|
34
|
-
* Request validation
|
|
33
|
+
* Randomly or statically generated response (`application/.*json`)
|
|
34
|
+
* Request validation (`application/.*json`, `multipart/form-data`)
|
|
35
35
|
* Load specification from local or remote
|
|
36
36
|
* Support hot reload local specification
|
|
37
37
|
* Support specification in yaml or json format
|
|
38
38
|
|
|
39
|
-
**Note:** Only support json content type as of now
|
|
40
|
-
|
|
41
39
|
## Installation
|
|
42
40
|
|
|
43
41
|
Install it with:
|
|
@@ -50,13 +48,14 @@ Or use the [docker image](https://hub.docker.com/r/realfengjia/fakeit)
|
|
|
50
48
|
|
|
51
49
|
$ fakeit --spec <Local file or remote url>
|
|
52
50
|
|
|
53
|
-
Command line options
|
|
51
|
+
### Command line options
|
|
54
52
|
|
|
55
53
|
$ fakeit --help
|
|
56
54
|
usage:
|
|
57
55
|
--spec spec file uri (required)
|
|
58
56
|
-p, --port custom port
|
|
59
57
|
-q, --quiet mute request and response log
|
|
58
|
+
-l, --log-file redirect log to a file
|
|
60
59
|
--permissive log validation error as warning instead of denying request
|
|
61
60
|
--use-example use example provided in spec if exists
|
|
62
61
|
--static generate static response
|
|
@@ -67,6 +66,33 @@ Command line options:
|
|
|
67
66
|
-v, --version
|
|
68
67
|
-h, --help
|
|
69
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
|
+
|
|
70
96
|
**Notes:**
|
|
71
97
|
* See [here](docs/random.md) for Openapi properties supported in random response generation
|
|
72
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 '*'
|
data/docs/random.md
CHANGED
|
@@ -11,7 +11,7 @@ The following Openapi properties are supported in random response generation
|
|
|
11
11
|
| |minItems|Default: `1`|
|
|
12
12
|
| |maxItems|Default: `minItems + 2`|
|
|
13
13
|
|string|enum| |
|
|
14
|
-
| |pattern| |
|
|
14
|
+
| |pattern|Random generated once and cached for performance concern|
|
|
15
15
|
| |format=uri| |
|
|
16
16
|
| |format=uuid| |
|
|
17
17
|
| |format=guid| |
|
data/fakeit.gemspec
CHANGED
|
@@ -22,20 +22,23 @@ Gem::Specification.new do |spec|
|
|
|
22
22
|
spec.executables = 'fakeit'
|
|
23
23
|
spec.require_paths = ['lib']
|
|
24
24
|
|
|
25
|
-
spec.required_ruby_version = '>=
|
|
25
|
+
spec.required_ruby_version = '>= 3.0.0'
|
|
26
26
|
|
|
27
27
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
|
28
28
|
spec.add_development_dependency 'byebug', '~> 11.0'
|
|
29
29
|
spec.add_development_dependency 'rack-test', '~> 1.1'
|
|
30
|
-
spec.add_development_dependency 'rake', '~>
|
|
30
|
+
spec.add_development_dependency 'rake', '~> 13.0'
|
|
31
31
|
spec.add_development_dependency 'rspec', '~> 3.0'
|
|
32
|
-
spec.add_development_dependency 'rubocop', '~>
|
|
32
|
+
spec.add_development_dependency 'rubocop', '~> 1.10'
|
|
33
|
+
spec.add_development_dependency 'rubocop-rake', '~> 0.5'
|
|
33
34
|
spec.add_development_dependency 'simplecov', '~> 0.18'
|
|
34
35
|
|
|
35
|
-
spec.add_dependency 'faker', '2.
|
|
36
|
-
spec.add_dependency 'openapi_parser', '0.
|
|
36
|
+
spec.add_dependency 'faker', '2.13.0'
|
|
37
|
+
spec.add_dependency 'openapi_parser', '0.12.1'
|
|
37
38
|
spec.add_dependency 'rack', '~> 2.0'
|
|
38
39
|
spec.add_dependency 'rack-cors', '~> 1.0'
|
|
39
40
|
spec.add_dependency 'rainbow', '~> 3.0'
|
|
41
|
+
spec.add_dependency 'regexp-examples', '1.5.1'
|
|
40
42
|
spec.add_dependency 'slop', '~> 4.8'
|
|
43
|
+
spec.add_dependency 'webrick', '~> 1.7'
|
|
41
44
|
end
|