lazy_api_doc 0.2.5 → 0.2.6
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/.ruby-version +1 -1
- data/Gemfile.lock +47 -36
- data/docs/example/index.html +1 -1
- data/lazy_api_doc.gemspec +2 -0
- data/lib/generators/lazy_api_doc/templates/public/index.html +1 -1
- data/lib/lazy_api_doc/generator.rb +5 -1
- data/lib/lazy_api_doc/route_parser.rb +1 -1
- data/lib/lazy_api_doc/variants_parser.rb +4 -4
- data/lib/lazy_api_doc/version.rb +1 -1
- metadata +18 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3089fde7c5d3c9cce883fe8d92e2a945b35971e70d6ab7cdd6271dfd517ba642
|
|
4
|
+
data.tar.gz: 68b995f02c1057ae7bdc07eaf933640655804a947f49033b61e583e7f1e49ef8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9902d226187a5f4c2f3680f3585684adc7ca928dd6bd60b2971b71a901d7e27a874628a49b7c532cdf0d1f2bd8fb12f4d82119b5a7abb1adc65c4fe46e4bc819
|
|
7
|
+
data.tar.gz: 45d352415cdb5b57e7f21d6dba8d8c3275a8b7c3e305fb7029564ab54726c7f360d1483d6f38119b4af8badaf5d8a971162d3e513b0bf6a490c9987b09c7b30e
|
data/.ruby-version
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
ruby-3.
|
|
1
|
+
ruby-3.4.4
|
data/Gemfile.lock
CHANGED
|
@@ -1,57 +1,68 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
lazy_api_doc (0.2.
|
|
4
|
+
lazy_api_doc (0.2.6)
|
|
5
|
+
ostruct
|
|
5
6
|
|
|
6
7
|
GEM
|
|
7
8
|
remote: https://rubygems.org/
|
|
8
9
|
specs:
|
|
9
|
-
ast (2.4.
|
|
10
|
-
diff-lcs (1.
|
|
11
|
-
docile (1.4.
|
|
12
|
-
json (2.
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
ast (2.4.3)
|
|
11
|
+
diff-lcs (1.6.2)
|
|
12
|
+
docile (1.4.1)
|
|
13
|
+
json (2.19.5)
|
|
14
|
+
language_server-protocol (3.17.0.5)
|
|
15
|
+
lint_roller (1.1.0)
|
|
16
|
+
ostruct (0.6.3)
|
|
17
|
+
parallel (1.28.0)
|
|
18
|
+
parser (3.3.11.1)
|
|
15
19
|
ast (~> 2.4.1)
|
|
20
|
+
racc
|
|
21
|
+
prism (1.9.0)
|
|
22
|
+
racc (1.8.1)
|
|
16
23
|
rainbow (3.1.1)
|
|
17
24
|
rake (12.3.3)
|
|
18
|
-
regexp_parser (2.
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
rspec-
|
|
22
|
-
rspec-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
rspec-expectations (3.9.0)
|
|
25
|
+
regexp_parser (2.12.0)
|
|
26
|
+
rspec (3.13.2)
|
|
27
|
+
rspec-core (~> 3.13.0)
|
|
28
|
+
rspec-expectations (~> 3.13.0)
|
|
29
|
+
rspec-mocks (~> 3.13.0)
|
|
30
|
+
rspec-core (3.13.6)
|
|
31
|
+
rspec-support (~> 3.13.0)
|
|
32
|
+
rspec-expectations (3.13.5)
|
|
27
33
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
28
|
-
rspec-support (~> 3.
|
|
29
|
-
rspec-mocks (3.
|
|
34
|
+
rspec-support (~> 3.13.0)
|
|
35
|
+
rspec-mocks (3.13.8)
|
|
30
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
|
31
|
-
rspec-support (~> 3.
|
|
32
|
-
rspec-support (3.
|
|
33
|
-
rubocop (1.
|
|
37
|
+
rspec-support (~> 3.13.0)
|
|
38
|
+
rspec-support (3.13.7)
|
|
39
|
+
rubocop (1.86.1)
|
|
34
40
|
json (~> 2.3)
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
language_server-protocol (~> 3.17.0.2)
|
|
42
|
+
lint_roller (~> 1.1.0)
|
|
43
|
+
parallel (>= 1.10)
|
|
44
|
+
parser (>= 3.3.0.2)
|
|
37
45
|
rainbow (>= 2.2.2, < 4.0)
|
|
38
|
-
regexp_parser (>=
|
|
39
|
-
|
|
40
|
-
rubocop-ast (>= 1.26.0, < 2.0)
|
|
46
|
+
regexp_parser (>= 2.9.3, < 3.0)
|
|
47
|
+
rubocop-ast (>= 1.49.0, < 2.0)
|
|
41
48
|
ruby-progressbar (~> 1.7)
|
|
42
|
-
unicode-display_width (>= 2.4.0, <
|
|
43
|
-
rubocop-ast (1.
|
|
44
|
-
parser (>= 3.
|
|
45
|
-
|
|
46
|
-
|
|
49
|
+
unicode-display_width (>= 2.4.0, < 4.0)
|
|
50
|
+
rubocop-ast (1.49.1)
|
|
51
|
+
parser (>= 3.3.7.2)
|
|
52
|
+
prism (~> 1.7)
|
|
53
|
+
rubocop-rspec (3.9.0)
|
|
54
|
+
lint_roller (~> 1.1)
|
|
55
|
+
rubocop (~> 1.81)
|
|
47
56
|
ruby-progressbar (1.13.0)
|
|
48
|
-
simplecov (0.
|
|
57
|
+
simplecov (0.22.0)
|
|
49
58
|
docile (~> 1.1)
|
|
50
59
|
simplecov-html (~> 0.11)
|
|
51
60
|
simplecov_json_formatter (~> 0.1)
|
|
52
|
-
simplecov-html (0.
|
|
53
|
-
simplecov_json_formatter (0.1.
|
|
54
|
-
unicode-display_width (2.
|
|
61
|
+
simplecov-html (0.13.2)
|
|
62
|
+
simplecov_json_formatter (0.1.4)
|
|
63
|
+
unicode-display_width (3.2.0)
|
|
64
|
+
unicode-emoji (~> 4.1)
|
|
65
|
+
unicode-emoji (4.2.0)
|
|
55
66
|
|
|
56
67
|
PLATFORMS
|
|
57
68
|
ruby
|
|
@@ -65,4 +76,4 @@ DEPENDENCIES
|
|
|
65
76
|
simplecov
|
|
66
77
|
|
|
67
78
|
BUNDLED WITH
|
|
68
|
-
|
|
79
|
+
4.0.11
|
data/docs/example/index.html
CHANGED
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<redoc spec-url='./api.yml'></redoc>
|
|
22
|
-
<script src="https://cdn.
|
|
22
|
+
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
|
|
23
23
|
</body>
|
|
24
24
|
</html>
|
data/lazy_api_doc.gemspec
CHANGED
|
@@ -19,6 +19,6 @@
|
|
|
19
19
|
</head>
|
|
20
20
|
<body>
|
|
21
21
|
<redoc spec-url='./api.yml'></redoc>
|
|
22
|
-
<script src="https://cdn.
|
|
22
|
+
<script src="https://cdn.redoc.ly/redoc/latest/bundles/redoc.standalone.js"></script>
|
|
23
23
|
</body>
|
|
24
24
|
</html>
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'cgi'
|
|
2
|
+
require 'ostruct'
|
|
2
3
|
|
|
3
4
|
module LazyApiDoc
|
|
4
5
|
class Generator
|
|
@@ -26,6 +27,7 @@ module LazyApiDoc
|
|
|
26
27
|
.group_by { |example| ::LazyApiDoc::RouteParser.find_by(example) }
|
|
27
28
|
.each do |route, examples|
|
|
28
29
|
next if route.nil? # TODO: think about adding such cases to log
|
|
30
|
+
|
|
29
31
|
first = examples.first
|
|
30
32
|
|
|
31
33
|
doc_path = route['doc_path']
|
|
@@ -111,7 +113,9 @@ module LazyApiDoc
|
|
|
111
113
|
first = examples.first
|
|
112
114
|
return unless %w[POST PATCH PUT DELETE].include?(first['verb'])
|
|
113
115
|
|
|
114
|
-
variants = examples.map
|
|
116
|
+
variants = examples.map do |example|
|
|
117
|
+
example.params.except(*EXCLUDED_PARAMS, *route['path_params'], *route['defaults'].keys)
|
|
118
|
+
end
|
|
115
119
|
{
|
|
116
120
|
'content' => {
|
|
117
121
|
first.content_type => {
|
|
@@ -26,7 +26,7 @@ module LazyApiDoc
|
|
|
26
26
|
|
|
27
27
|
def types_template(variants)
|
|
28
28
|
types = types_of(variants)
|
|
29
|
-
if types.
|
|
29
|
+
if types.one?
|
|
30
30
|
{
|
|
31
31
|
"type" => types.first
|
|
32
32
|
}
|
|
@@ -69,15 +69,15 @@ module LazyApiDoc
|
|
|
69
69
|
|
|
70
70
|
def parse_hash(variants)
|
|
71
71
|
result = types_template(variants)
|
|
72
|
-
variant = variants.
|
|
72
|
+
variant = variants.grep(Hash).reverse_each
|
|
73
73
|
.with_object({}) { |v, res| res.merge!(v) }
|
|
74
74
|
result["properties"] = variant.to_h do |key, val|
|
|
75
75
|
[
|
|
76
76
|
key.to_s,
|
|
77
|
-
parse(val, variants.
|
|
77
|
+
parse(val, variants.grep(Hash).map { |v| v.fetch(key, OPTIONAL) })
|
|
78
78
|
]
|
|
79
79
|
end
|
|
80
|
-
result["required"] = variant.keys.select { |key| variants.
|
|
80
|
+
result["required"] = variant.keys.select { |key| variants.grep(Hash).all? { |v| v.key?(key) } }
|
|
81
81
|
result
|
|
82
82
|
end
|
|
83
83
|
|
data/lib/lazy_api_doc/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lazy_api_doc
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bogdan Guban
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
12
|
-
dependencies:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: ostruct
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
13
26
|
description: 'The gem collects all requests and responses from your request specs
|
|
14
27
|
and generates documentation based on it
|
|
15
28
|
|
|
@@ -58,7 +71,6 @@ metadata:
|
|
|
58
71
|
source_code_uri: https://github.com/bguban/lazy_api_doc
|
|
59
72
|
changelog_uri: https://github.com/bguban/lazy_api_doc
|
|
60
73
|
rubygems_mfa_required: 'true'
|
|
61
|
-
post_install_message:
|
|
62
74
|
rdoc_options: []
|
|
63
75
|
require_paths:
|
|
64
76
|
- lib
|
|
@@ -73,8 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
73
85
|
- !ruby/object:Gem::Version
|
|
74
86
|
version: '0'
|
|
75
87
|
requirements: []
|
|
76
|
-
rubygems_version: 3.
|
|
77
|
-
signing_key:
|
|
88
|
+
rubygems_version: 3.6.7
|
|
78
89
|
specification_version: 4
|
|
79
90
|
summary: Creates openapi v3 documentation based on rspec request tests
|
|
80
91
|
test_files: []
|