fitting 2.15.0 → 2.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +3 -3
- data/CHANGELOG.md +7 -0
- data/README.md +75 -293
- data/example.png +0 -0
- data/example2.png +0 -0
- data/fitting.gemspec +3 -3
- data/lib/fitting/report/actions.rb +1 -5
- data/lib/fitting/report/console.rb +1 -1
- data/lib/fitting/report/prefix.rb +37 -2
- data/lib/fitting/report/prefixes.rb +11 -1
- data/lib/fitting/report/response.rb +2 -2
- data/lib/fitting/version.rb +1 -1
- data/lib/templates/bomboniere/package-lock.json +9 -3
- data/lib/templates/bomboniere/package.json +2 -1
- metadata +11 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9de3ef63b994a6585d5795ebff3c5473d5b150a47b29abab37d8c306a813e4ee
|
4
|
+
data.tar.gz: 0c8b4c52d63c38f4b1d6fb174b991544b185bedde24722b09428adfb0260cf05
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: df9e196563d7a3430b228d9bc4fdaf13600a4db62ee0c8182506b30a4c890fb39a4bb3dc0ae194df63d6a48489ccaf8817dda54c6e6ab3c509a9fa5ee73421c2
|
7
|
+
data.tar.gz: a140201ca99818ce637b39d80721a26a0c00a75beb5435778e41aacce5e60e953d6b62c285272295b48446c234c3992dd0b7c87c8670bad91d0601f64a7ded1e
|
data/.github/workflows/ruby.yml
CHANGED
@@ -23,10 +23,10 @@ jobs:
|
|
23
23
|
- name: Set up Ruby
|
24
24
|
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
25
25
|
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
26
|
-
|
27
|
-
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
|
+
# uses: ruby/setup-ruby@ec106b438a1ff6ff109590de34ddc62c540232e0
|
28
28
|
with:
|
29
|
-
ruby-version: 2.
|
29
|
+
ruby-version: 2.7
|
30
30
|
- name: Install dependencies
|
31
31
|
run: bundle install
|
32
32
|
- name: Run tests
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
### 2.16.0 - 2021-02-10
|
4
|
+
|
5
|
+
* features
|
6
|
+
* support swagger and openapi [#96](https://github.com/funbox/fitting/issues/96)
|
7
|
+
* patch
|
8
|
+
* let's bump to tomograph '3.0.1' [#95](https://github.com/funbox/fitting/issues/95)
|
9
|
+
|
3
10
|
### 2.15.0 - 2020-10-12
|
4
11
|
|
5
12
|
* features
|
data/README.md
CHANGED
@@ -1,41 +1,25 @@
|
|
1
1
|
# Fitting
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
This gem will help you implement your API in strict accordance to the documentation in [API Blueprint](https://apiblueprint.org/) format.
|
6
|
-
To do this, when you run your RSpec tests on controllers, it automatically searches for the corresponding JSON-schemas in the documentation and then validates responses with them.
|
2
|
+
Coverage API Blueprint, Swagger and OpenAPI with rspec tests for easily make high-quality API and documenatiton.
|
3
|
+
![exmaple](example.png)
|
7
4
|
|
8
5
|
## Installation
|
9
|
-
|
10
|
-
First you need to install [drafter](https://github.com/apiaryio/drafter).
|
11
|
-
|
12
|
-
Then add this line to your application's Gemfile:
|
13
|
-
|
6
|
+
Add this line to your application's Gemfile:
|
14
7
|
```ruby
|
15
8
|
gem 'fitting'
|
16
9
|
```
|
17
10
|
|
18
11
|
After that execute:
|
19
|
-
|
20
12
|
```bash
|
21
13
|
$ bundle
|
22
14
|
```
|
23
15
|
|
24
16
|
Or install the gem by yourself:
|
25
|
-
|
26
17
|
```bash
|
27
18
|
$ gem install fitting
|
28
19
|
```
|
29
20
|
|
30
21
|
## Usage
|
31
|
-
|
32
|
-
Add this to your `.fitting.yml`:
|
33
|
-
|
34
|
-
```yaml
|
35
|
-
apib_path: /path/to/doc.apib
|
36
|
-
```
|
37
|
-
|
38
|
-
And this to your `spec_helper.rb`:
|
22
|
+
And next to your `spec_helper.rb`:
|
39
23
|
|
40
24
|
```ruby
|
41
25
|
require 'fitting'
|
@@ -43,305 +27,103 @@ require 'fitting'
|
|
43
27
|
Fitting.save_test_data
|
44
28
|
```
|
45
29
|
|
46
|
-
|
47
|
-
|
48
|
-
Output example:
|
49
|
-
|
50
|
-
```json
|
51
|
-
[
|
52
|
-
{
|
53
|
-
"method": "GET",
|
54
|
-
"path": "/api/v1/book",
|
55
|
-
"body": {},
|
56
|
-
"response": {
|
57
|
-
"status": 200,
|
58
|
-
"body": {
|
59
|
-
"title": "The Martian Chronicles"
|
60
|
-
}
|
61
|
-
},
|
62
|
-
"title": "/spec/controllers/api/v1/books_controller_spec.rb:11",
|
63
|
-
"group": "/spec/controllers/api/v1/books_controller_spec.rb"
|
64
|
-
},
|
65
|
-
{
|
66
|
-
"method": "POST",
|
67
|
-
"path": "/api/v1/book",
|
68
|
-
"body": {},
|
69
|
-
"response": {
|
70
|
-
"status": 200,
|
71
|
-
"body": {
|
72
|
-
"title": "The Old Man and the Sea"
|
73
|
-
}
|
74
|
-
},
|
75
|
-
"title": "/spec/controllers/api/v1/books_controller_spec.rb:22",
|
76
|
-
"group": "/spec/controllers/api/v1/books_controller_spec.rb"
|
77
|
-
}
|
78
|
-
]
|
79
|
-
```
|
80
|
-
|
81
|
-
## Documentation coverage
|
82
|
-
|
83
|
-
To match routes and validate JSON-schemas run:
|
84
|
-
|
85
|
-
```bash
|
86
|
-
rake fitting:documentation_responses[report_size]
|
87
|
-
```
|
88
|
-
|
89
|
-
There are four types (or `report_size`) of reports available:
|
90
|
-
|
91
|
-
- `xs` — the smallest report;
|
92
|
-
- `s` — includes coverage for `required` fields;
|
93
|
-
- `m` — includes coverage for `required` and `enum` fields;
|
94
|
-
- `l` — includes coverage for `required`, `enum` and `oneOf` fields.
|
95
|
-
|
96
|
-
E.g. for `xs` size:
|
97
|
-
|
98
|
-
```bash
|
99
|
-
rake fitting:documentation_responses[xs]
|
100
|
-
```
|
101
|
-
|
102
|
-
**Note**: In zsh you should add quotes around the task:
|
103
|
-
|
104
|
-
```bash
|
105
|
-
rake 'fitting:documentation_responses[xs]'
|
106
|
-
```
|
107
|
-
|
108
|
-
Also you can use `documentation_responses_error` to get more detailed errors description.
|
109
|
-
Check the examples below.
|
110
|
-
|
111
|
-
### Examples
|
112
|
-
|
113
|
-
`xs` size:
|
114
|
-
|
115
|
-
```text
|
116
|
-
Fully conforming requests:
|
117
|
-
DELETE /api/v1/book ✔ 200 ✔ 201 ✔ 404
|
118
|
-
DELETE /api/v1/book/{id} ✔ 200 ✔ 201 ✔ 404
|
119
|
-
GET /api/v1/book/{id}/seller ✔ 200 ✔ 201 ✔ 404
|
120
|
-
|
121
|
-
Partially conforming requests:
|
122
|
-
GET /api/v1/book ✖ 200 ✔ 404
|
123
|
-
POST /api/v1/book ✖ 200 ✔ 201 ✔ 404
|
124
|
-
GET /api/v1/book/{id} ✖ 200 ✔ 404 ✔ 200
|
125
|
-
PATCH /api/v1/book/{id} ✖ 200 ✔ 201 ✔ 404
|
126
|
-
|
127
|
-
Non-conforming requests:
|
128
|
-
GET /api/v1/seller ✖ 200 ✖ 201 ✖ 404
|
129
|
-
GET /api/v1/buyer ✖ 200 ✖ 404
|
130
|
-
|
131
|
-
API requests with fully implemented responses: 3 (33.33% of 9).
|
132
|
-
API requests with partially implemented responses: 4 (44.44% of 9).
|
133
|
-
API requests with no implemented responses: 2 (22.22% of 9).
|
134
|
-
|
135
|
-
API responses conforming to the blueprint: 16 (64.00% of 25).
|
136
|
-
API responses with validation errors or untested: 9 (36.00% of 25).
|
137
|
-
```
|
138
|
-
|
139
|
-
`s` size:
|
140
|
-
|
141
|
-
```text
|
142
|
-
Fully conforming requests:
|
143
|
-
DELETE /api/v1/book 100% 200 100% 201 100% 404
|
144
|
-
DELETE /api/v1/book/{id} 100% 200 100% 201 100% 404
|
145
|
-
GET /api/v1/book/{id}/seller 100% 200 100% 201 100% 404
|
146
|
-
|
147
|
-
Partially conforming requests:
|
148
|
-
GET /api/v1/book 0% 200 66% 404
|
149
|
-
POST /api/v1/book 0% 200 90% 201 100% 404
|
150
|
-
GET /api/v1/book/{id} 0% 200 88% 404 10% 200
|
151
|
-
PATCH /api/v1/book/{id} 0% 200 100% 201 10% 404
|
152
|
-
|
153
|
-
Non-conforming requests:
|
154
|
-
GET /api/v1/seller 0% 200 0% 201 0 404
|
155
|
-
GET /api/v1/buyer 0% 200 0% 404
|
156
|
-
|
157
|
-
API requests with fully implemented responses: 3 (33.33% of 9).
|
158
|
-
API requests with partially implemented responses: 4 (44.44% of 9).
|
159
|
-
API requests with no implemented responses: 2 (22.22% of 9).
|
160
|
-
|
161
|
-
API responses conforming to the blueprint: 16 (64.00% of 25).
|
162
|
-
API responses with validation errors or untested: 9 (36.00% of 25).
|
163
|
-
```
|
30
|
+
Add this to your `.fitting.yml`:
|
164
31
|
|
165
|
-
|
32
|
+
### OpenAPI 2.0
|
33
|
+
Also Swagger
|
166
34
|
|
35
|
+
```yaml
|
36
|
+
prefixes:
|
37
|
+
- name: /api/v1
|
38
|
+
openapi2_json_path: doc.json
|
167
39
|
```
|
168
|
-
request method: GET
|
169
|
-
request path: /api/v1/book
|
170
|
-
response status: 200
|
171
|
-
source json-schema: {"$schema"=>"http://json-schema.org/draft-04/schema#", "type"=>"object", ...}
|
172
|
-
combination: ["required", "pages"]
|
173
|
-
new json-schema: {"$schema"=>"http://json-schema.org/draft-04/schema#", "type"=>"object", ...}
|
174
|
-
```
|
175
|
-
|
176
|
-
### Experimental report
|
177
40
|
|
178
|
-
|
41
|
+
### OpenAPI 3.0
|
42
|
+
Also OpenAPI
|
179
43
|
|
180
|
-
```
|
181
|
-
|
44
|
+
```yaml
|
45
|
+
prefixes:
|
46
|
+
- name: /api/v1
|
47
|
+
openapi3_yaml_path: doc.yaml
|
182
48
|
```
|
183
49
|
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
## Tests coverage
|
50
|
+
### API Blueprint
|
51
|
+
First you need to install [drafter](https://github.com/apiaryio/drafter).
|
52
|
+
Works after conversion from API Blueprint to API Elements (in YAML file) with Drafter.
|
188
53
|
|
189
|
-
|
54
|
+
That is, I mean that you first need to do this
|
190
55
|
|
191
56
|
```bash
|
192
|
-
|
193
|
-
```
|
194
|
-
|
195
|
-
## Config
|
196
|
-
|
197
|
-
You can specify the settings either in a YAML file `.fitting.yml` or in a config.
|
198
|
-
If your project uses several prefixes, for each one you should create a separate YAML file in the folder `fitting` (`fitting/*.yml`).
|
199
|
-
|
200
|
-
All the available config options are described below.
|
201
|
-
|
202
|
-
### `apib_path`
|
203
|
-
|
204
|
-
Path to API Blueprint v3 documentation.
|
205
|
-
There must be an installed [drafter](https://github.com/apiaryio/drafter) to parse it.
|
206
|
-
|
207
|
-
### `drafter_yaml_path`
|
208
|
-
|
209
|
-
Path to API Blueprint v3 documentation, pre-parsed with `drafter` and saved to a YAML file.
|
210
|
-
|
211
|
-
### `drafter_4_apib_path`
|
212
|
-
|
213
|
-
Path to API Blueprint v4 documentation.
|
214
|
-
There must be an installed [drafter](https://github.com/apiaryio/drafter) to parse it.
|
215
|
-
|
216
|
-
### `drafter_4_yaml_path`
|
217
|
-
|
218
|
-
Path to API Blueprint v4 documentation, pre-parsed with `drafter` and saved to a YAML file.
|
219
|
-
|
220
|
-
### `crafter_apib_path`
|
221
|
-
|
222
|
-
Path to API Blueprint v4 documentation.
|
223
|
-
|
224
|
-
### `crafter_yaml_path`
|
225
|
-
|
226
|
-
Path to API Blueprint v4 documentation, pre-parsed with `crafter` and saved to a YAML file.
|
227
|
-
|
228
|
-
### `tomogram_json_path`
|
229
|
-
|
230
|
-
Path to Tomogram documentation, pre-parsed with [tomograph](https://github.com/funbox/tomograph) and saved to a JSON file.
|
231
|
-
|
232
|
-
### `strict`
|
233
|
-
|
234
|
-
Default: `false`
|
235
|
-
|
236
|
-
When `true` all properties are considered to have `"required": true` and all objects are considered to have `"additionalProperties": false`.
|
237
|
-
|
238
|
-
### `prefix`
|
239
|
-
|
240
|
-
Prefix for API requests. E.g. `'/api'`. Validation will not be performed if the request path does not start with a prefix.
|
241
|
-
|
242
|
-
### `white_list`
|
243
|
-
|
244
|
-
Default: all paths
|
245
|
-
|
246
|
-
This is an array of paths that are mandatory for implementation.
|
247
|
-
The list does not affect the work of the matcher.
|
248
|
-
It's used for the CLI report only.
|
249
|
-
|
250
|
-
```yaml
|
251
|
-
white_list:
|
252
|
-
/users:
|
253
|
-
- DELETE
|
254
|
-
- POST
|
255
|
-
/users/{id}:
|
256
|
-
- GET
|
257
|
-
- PATCH
|
258
|
-
/users/{id}/employees:
|
259
|
-
- GET
|
260
|
-
/sessions: []
|
57
|
+
drafter doc.apib -o doc.yaml
|
261
58
|
```
|
262
59
|
|
263
|
-
|
264
|
-
|
265
|
-
### `resource_white_list`
|
266
|
-
|
267
|
-
Default: all resources
|
268
|
-
|
269
|
-
This is an array of resources that are mandatory for implementation.
|
270
|
-
The list does not affect the work of the matcher.
|
271
|
-
It's used for the CLI report only.
|
60
|
+
and then
|
272
61
|
|
273
62
|
```yaml
|
274
|
-
|
275
|
-
/
|
276
|
-
|
277
|
-
- POST /users
|
278
|
-
- GET /users/{id}
|
279
|
-
- PATCH /users/{id}
|
280
|
-
/users/{id}/employees:
|
281
|
-
- GET /users/{id}/employees
|
282
|
-
/sessions: []
|
63
|
+
prefixes:
|
64
|
+
- name: /api/v1
|
65
|
+
drafter_yaml_path: doc.yaml
|
283
66
|
```
|
284
67
|
|
285
|
-
|
286
|
-
|
287
|
-
### `json_schema_cover`
|
288
|
-
|
289
|
-
Default: false
|
290
|
-
|
291
|
-
JSON-schema covering becomes mandatory.
|
292
|
-
However, if you don't use `Fitting.statistics` you can call `responses.statistics.cover_save`.
|
293
|
-
|
294
|
-
### `include_resources`
|
68
|
+
### Tomograph
|
295
69
|
|
296
|
-
|
297
|
-
|
298
|
-
This is an array of resources that are mandatory for implementation.
|
299
|
-
The list does not affect the work of the matcher.
|
300
|
-
It's used for the CLI report only.
|
70
|
+
To use additional features of the pre-converted [tomograph](https://github.com/funbox/tomograph)
|
301
71
|
|
302
72
|
```yaml
|
303
|
-
|
304
|
-
- /
|
73
|
+
prefixes:
|
74
|
+
- name: /api/v1
|
75
|
+
tomogram_json_path: doc.json
|
305
76
|
```
|
306
77
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
This is an array of paths that are mandatory for implementation.
|
312
|
-
The list does not affect the work of the matcher.
|
313
|
-
It's used for the CLI report only.
|
314
|
-
|
315
|
-
```yaml
|
316
|
-
include_actions:
|
317
|
-
- DELETE /users/{id}
|
318
|
-
- POST /users
|
319
|
-
- GET /users/{id}
|
320
|
-
- PATCH /users/{id}
|
321
|
-
- GET /users/{id}/employees
|
78
|
+
## Run
|
79
|
+
Run tests first to get run artifacts
|
80
|
+
```bash
|
81
|
+
bundle e rspec
|
322
82
|
```
|
323
83
|
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
```yaml
|
329
|
-
ignore_list:
|
330
|
-
- %r{/api/v1/users/[1-9].}
|
331
|
-
- %r{/api/v1/comments}
|
84
|
+
and then
|
85
|
+
```bash
|
86
|
+
bundle e rake fitting:report
|
332
87
|
```
|
333
88
|
|
334
|
-
|
335
|
-
|
336
|
-
### `prefixes`
|
89
|
+
Console ouptut
|
337
90
|
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
91
|
+
```text
|
92
|
+
/api/v1
|
93
|
+
POST /api/v1/accounts/{account_id}/inboxes 0% 200 0% 404 0% 403
|
94
|
+
PATCH /api/v1/accounts/{account_id}/inboxes/{id} 0% 200 0% 404 0% 403
|
95
|
+
POST /api/v1/accounts/{account_id}/inboxes/{id}/set_agent_bot 0% 204 100% 404 0% 403
|
96
|
+
GET /api/v1/agent_bots 0% 200 0% 404 0% 403
|
97
|
+
GET /api/v1/accounts/{account_id}/conversations 0% 200 0% 400 0% description
|
98
|
+
POST /api/v1/accounts/{account_id}/conversations 0% 200 0% 403
|
99
|
+
GET /api/v1/accounts/{account_id}/conversations/{id} 59% 200 0% 404 0% 403
|
100
|
+
POST /api/v1/accounts/{account_id}/conversations/{id}/toggle_status 80% 200 0% 404 0% 403
|
101
|
+
GET /api/v1/accounts/{account_id}/conversations/{id}/messages 47% 200 0% 404 0% 403
|
102
|
+
POST /api/v1/accounts/{account_id}/conversations/{id}/messages 0% 200 0% 404 0% 403
|
103
|
+
GET /api/v1/accounts/{account_id}/conversations/{id}/labels 100% 200 0% 404 0% 403
|
104
|
+
POST /api/v1/accounts/{account_id}/conversations/{id}/labels 100% 200 0% 404 0% 403
|
105
|
+
POST /api/v1/accounts/{account_id}/conversations/{id}/assignments 77% 200 0% 404 0% 403
|
106
|
+
GET /api/v1/accounts/{account_id}/contacts 0% 200 0% 400
|
107
|
+
POST /api/v1/accounts/{account_id}/contacts 14% 200 0% 400
|
108
|
+
GET /api/v1/accounts/{account_id}/contacts/{id} 14% 200 0% 404 0% 403
|
109
|
+
PUT /api/v1/accounts/{account_id}/contacts/{id} 0% 204 0% 404 0% 403
|
110
|
+
GET /api/v1/accounts/{account_id}/contacts/{id}/conversations 0% 200 0% 404 0% 403
|
111
|
+
GET /api/v1/accounts/{account_id}/contacts/search 0% 200 0% 401
|
112
|
+
POST /api/v1/accounts/{account_id}/contacts/{id}/contact_inboxes 0% 200 0% 401 100% 422
|
113
|
+
GET /api/v1/profile 88% 200 100% 401
|
114
|
+
|
115
|
+
tests_without_prefixes: 42
|
116
|
+
tests_without_actions: 144
|
117
|
+
tests_without_responses: 43
|
118
|
+
```
|
119
|
+
|
120
|
+
And task will create HTML (`fitting/index.html`) reports.
|
121
|
+
|
122
|
+
![exmaple](example.png)
|
123
|
+
|
124
|
+
More information on action coverage
|
125
|
+
|
126
|
+
![exmaple2](example2.png)
|
345
127
|
|
346
128
|
## Contributing
|
347
129
|
|
data/example.png
ADDED
Binary file
|
data/example2.png
ADDED
Binary file
|
data/fitting.gemspec
CHANGED
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ['d.efimov']
|
9
9
|
spec.email = ['d.efimov@fun-box.ru']
|
10
10
|
|
11
|
-
spec.summary = '
|
12
|
-
spec.description = '
|
11
|
+
spec.summary = 'Coverage API Blueprint, Swagger and OpenAPI with rspec tests'
|
12
|
+
spec.description = 'Coverage API Blueprint, Swagger and OpenAPI with rspec tests for easily make high-quality API and documenatiton.'
|
13
13
|
spec.homepage = 'https://github.com/funbox/fitting'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
|
|
20
20
|
|
21
21
|
spec.add_runtime_dependency 'json-schema', '~> 2.6', '>= 2.6.2'
|
22
22
|
spec.add_runtime_dependency 'multi_json', '~> 1.11'
|
23
|
-
spec.add_runtime_dependency 'tomograph', '~> 3.
|
23
|
+
spec.add_runtime_dependency 'tomograph', '~> 3.1', '>= 3.1.0'
|
24
24
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
25
25
|
spec.add_development_dependency 'byebug', '~> 8.2', '>= 8.2.1'
|
26
26
|
spec.add_development_dependency 'rake', '>= 12.3.3'
|
@@ -3,11 +3,7 @@ require 'fitting/report/action'
|
|
3
3
|
module Fitting
|
4
4
|
module Report
|
5
5
|
class Actions
|
6
|
-
def initialize(
|
7
|
-
actions = Tomograph::Tomogram.new(
|
8
|
-
prefix: prefix,
|
9
|
-
tomogram_json_path: tomogram_json_path
|
10
|
-
)
|
6
|
+
def initialize(actions)
|
11
7
|
@actions = []
|
12
8
|
actions.to_a.map do |action|
|
13
9
|
@actions.push(Fitting::Report::Action.new(action))
|
@@ -15,7 +15,7 @@ module Fitting
|
|
15
15
|
@tests_without_actions += prefix_details[:actions][:tests_without_actions]
|
16
16
|
res += prefix_details[:actions][:actions_details].inject('') do |res_actions, action|
|
17
17
|
res_actions += "#{action[:method]}\t#{action[:path]}"
|
18
|
-
tab = "\t" * (
|
18
|
+
tab = "\t" * (8 - action[:path].size / 8)
|
19
19
|
@tests_without_responses += action[:responses][:tests_without_responses]
|
20
20
|
res_actions += tab + action[:responses][:responses_details].inject('') do |res_responses, response|
|
21
21
|
@good = false if response[:combinations][:cover_percent] != '100%'
|
@@ -3,13 +3,48 @@ require 'fitting/report/actions'
|
|
3
3
|
module Fitting
|
4
4
|
module Report
|
5
5
|
class Prefix
|
6
|
-
def initialize(name, tomogram_json_path, skip
|
6
|
+
def initialize(name: '', openapi2_json_path: nil, openapi3_yaml_path: nil, drafter_yaml_path: nil, tomogram_json_path: nil, crafter_yaml_path: nil, skip: false)
|
7
7
|
@name = name
|
8
8
|
@tomogram_json_path = tomogram_json_path
|
9
9
|
@tests = Fitting::Report::Tests.new([])
|
10
10
|
@skip = skip
|
11
11
|
unless skip
|
12
|
-
@actions =
|
12
|
+
@actions = if openapi2_json_path
|
13
|
+
Fitting::Report::Actions.new(
|
14
|
+
Tomograph::Tomogram.new(
|
15
|
+
prefix: name,
|
16
|
+
openapi2_json_path: openapi2_json_path
|
17
|
+
)
|
18
|
+
)
|
19
|
+
elsif openapi3_yaml_path
|
20
|
+
Fitting::Report::Actions.new(
|
21
|
+
Tomograph::Tomogram.new(
|
22
|
+
prefix: name,
|
23
|
+
openapi3_yaml_path: openapi3_yaml_path
|
24
|
+
)
|
25
|
+
)
|
26
|
+
elsif drafter_yaml_path
|
27
|
+
Fitting::Report::Actions.new(
|
28
|
+
Tomograph::Tomogram.new(
|
29
|
+
prefix: name,
|
30
|
+
drafter_yaml_path: drafter_yaml_path
|
31
|
+
)
|
32
|
+
)
|
33
|
+
elsif crafter_yaml_path
|
34
|
+
Fitting::Report::Actions.new(
|
35
|
+
Tomograph::Tomogram.new(
|
36
|
+
prefix: name,
|
37
|
+
crafter_yaml_path: crafter_yaml_path
|
38
|
+
)
|
39
|
+
)
|
40
|
+
else
|
41
|
+
Fitting::Report::Actions.new(
|
42
|
+
Tomograph::Tomogram.new(
|
43
|
+
prefix: name,
|
44
|
+
tomogram_json_path: tomogram_json_path
|
45
|
+
)
|
46
|
+
)
|
47
|
+
end
|
13
48
|
end
|
14
49
|
end
|
15
50
|
|
@@ -6,7 +6,17 @@ module Fitting
|
|
6
6
|
def initialize(config_path)
|
7
7
|
@prefixes = []
|
8
8
|
YAML.safe_load(File.read(config_path))['prefixes'].map do |prefix|
|
9
|
-
@prefixes.push(
|
9
|
+
@prefixes.push(
|
10
|
+
Fitting::Report::Prefix.new(
|
11
|
+
name: prefix['name'],
|
12
|
+
openapi2_json_path: prefix['openapi2_json_path'],
|
13
|
+
openapi3_yaml_path: prefix['openapi3_yaml_path'],
|
14
|
+
drafter_yaml_path: prefix['drafter_yaml_path'],
|
15
|
+
tomogram_json_path: prefix['tomogram_json_path'],
|
16
|
+
crafter_yaml_path: prefix['crafter_yaml_path'],
|
17
|
+
skip: prefix['skip']
|
18
|
+
)
|
19
|
+
)
|
10
20
|
end
|
11
21
|
end
|
12
22
|
|
data/lib/fitting/version.rb
CHANGED
@@ -1594,6 +1594,12 @@
|
|
1594
1594
|
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
1595
1595
|
"dev": true
|
1596
1596
|
},
|
1597
|
+
"highlight.js": {
|
1598
|
+
"version": "9.18.5",
|
1599
|
+
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.18.5.tgz",
|
1600
|
+
"integrity": "sha512-a5bFyofd/BHCX52/8i8uJkjr9DYwXIPnM/plwI6W7ezItLGqzt7X2G2nXuYSfsIJdkwwj/g9DG1LkcGJI/dDoA==",
|
1601
|
+
"dev": true
|
1602
|
+
},
|
1597
1603
|
"supports-color": {
|
1598
1604
|
"version": "7.1.0",
|
1599
1605
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
|
@@ -3817,9 +3823,9 @@
|
|
3817
3823
|
"dev": true
|
3818
3824
|
},
|
3819
3825
|
"highlight.js": {
|
3820
|
-
"version": "
|
3821
|
-
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-
|
3822
|
-
"integrity": "sha512-
|
3826
|
+
"version": "10.4.1",
|
3827
|
+
"resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-10.4.1.tgz",
|
3828
|
+
"integrity": "sha512-yR5lWvNz7c85OhVAEAeFhVCc/GV4C30Fjzc/rCP0aCWzc1UUOPUk55dK/qdwTZHBvMZo+eZ2jpk62ndX/xMFlg==",
|
3823
3829
|
"dev": true
|
3824
3830
|
},
|
3825
3831
|
"hmac-drbg": {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fitting
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- d.efimov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json-schema
|
@@ -50,20 +50,20 @@ dependencies:
|
|
50
50
|
requirements:
|
51
51
|
- - ">="
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 3.
|
53
|
+
version: 3.1.0
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version: '3.
|
56
|
+
version: '3.1'
|
57
57
|
type: :runtime
|
58
58
|
prerelease: false
|
59
59
|
version_requirements: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version: 3.
|
63
|
+
version: 3.1.0
|
64
64
|
- - "~>"
|
65
65
|
- !ruby/object:Gem::Version
|
66
|
-
version: '3.
|
66
|
+
version: '3.1'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: bundler
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,7 +172,8 @@ dependencies:
|
|
172
172
|
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: 0.11.2
|
175
|
-
description:
|
175
|
+
description: Coverage API Blueprint, Swagger and OpenAPI with rspec tests for easily
|
176
|
+
make high-quality API and documenatiton.
|
176
177
|
email:
|
177
178
|
- d.efimov@fun-box.ru
|
178
179
|
executables: []
|
@@ -192,6 +193,8 @@ files:
|
|
192
193
|
- Rakefile
|
193
194
|
- bin/console
|
194
195
|
- bin/setup
|
196
|
+
- example.png
|
197
|
+
- example2.png
|
195
198
|
- fitting.gemspec
|
196
199
|
- lib/fitting.rb
|
197
200
|
- lib/fitting/configuration.rb
|
@@ -304,5 +307,5 @@ requirements: []
|
|
304
307
|
rubygems_version: 3.0.1
|
305
308
|
signing_key:
|
306
309
|
specification_version: 4
|
307
|
-
summary:
|
310
|
+
summary: Coverage API Blueprint, Swagger and OpenAPI with rspec tests
|
308
311
|
test_files: []
|