lazy_api_doc 0.2.0 → 0.2.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b9bdbff963854199877b4fbcf1712ef7734a350b305e0fd0e6dc331cf3a3dd4
|
4
|
+
data.tar.gz: 7e8247e2001ff3dd2cd4caea9a269c25d094c0d718eb7385de417c6873cf6d84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6e4a437cce43bf45cb7f53deec99b8b981af170debac416cd4ac6e835f45b2d12ac3b51f9314c9b7136116585d4401f32a27e5d0f3d24678b9b4b765b363ab9
|
7
|
+
data.tar.gz: c972f6b00a4bdd8e0f2a3f7a9a117d4d72063bb6f05c8174d75d8e28c1ffbd739a2aa9f422d612110234ec5bb1a20ab254518aa497d2423cd33b9026ac4f2fb3
|
data/Gemfile.lock
CHANGED
@@ -44,7 +44,7 @@ module LazyApiDoc
|
|
44
44
|
# This peace of code handle using ParallelTests (tests runs in independent processes).
|
45
45
|
# Just delete this block if you don't use ParallelTests
|
46
46
|
if ENV['TEST_ENV_NUMBER'] && defined?(ParallelTests)
|
47
|
-
LazyApiDoc.save_examples
|
47
|
+
LazyApiDoc.save_examples('rspec')
|
48
48
|
ParallelTests.wait_for_other_processes_to_finish if ParallelTests.first_process?
|
49
49
|
LazyApiDoc.load_examples
|
50
50
|
end
|
@@ -75,7 +75,7 @@ module LazyApiDoc
|
|
75
75
|
# This peace of code handle using ParallelTests (tests runs in independent processes).
|
76
76
|
# Just delete this block if you don't use ParallelTests
|
77
77
|
if ENV['TEST_ENV_NUMBER'] && defined?(ParallelTests)
|
78
|
-
LazyApiDoc.save_examples
|
78
|
+
LazyApiDoc.save_examples('minitest')
|
79
79
|
ParallelTests.wait_for_other_processes_to_finish if ParallelTests.first_process?
|
80
80
|
LazyApiDoc.load_examples
|
81
81
|
end
|
@@ -85,12 +85,10 @@ module LazyApiDoc
|
|
85
85
|
|
86
86
|
def query_params(examples)
|
87
87
|
query_variants = examples.map do |example|
|
88
|
-
|
89
|
-
next {}
|
88
|
+
_path, query = example.request['full_path'].split('?')
|
89
|
+
next {} unless query
|
90
90
|
|
91
|
-
|
92
|
-
full_path.last.split('&').map { |part| part.split('=').map { |each| CGI.unescape(each) } }.group_by(&:first)
|
93
|
-
.transform_values { |v| v.map(&:last) }.map { |k, v| [k, k.match?(/\[\]\z/) ? v : v.first] }.to_h
|
91
|
+
CGI.parse(query).map { |k, v| [k.gsub('[]', ''), k.match?('\[\]') ? v : v.first] }.to_h
|
94
92
|
end
|
95
93
|
|
96
94
|
parsed = ::LazyApiDoc::VariantsParser.new(query_variants).result
|
@@ -73,10 +73,10 @@ module LazyApiDoc
|
|
73
73
|
result["properties"] = variant.map do |key, val|
|
74
74
|
[
|
75
75
|
key.to_s,
|
76
|
-
parse(val, variants.
|
76
|
+
parse(val, variants.select { |v| v.is_a?(Hash) }.map { |v| v.fetch(key, OPTIONAL) })
|
77
77
|
]
|
78
78
|
end.to_h
|
79
|
-
result["required"] = variant.keys.select { |key| variants.
|
79
|
+
result["required"] = variant.keys.select { |key| variants.select { |v| v.is_a?(Hash) }.all? { |v| v.key?(key) } }
|
80
80
|
result
|
81
81
|
end
|
82
82
|
|
data/lib/lazy_api_doc/version.rb
CHANGED
data/lib/lazy_api_doc.rb
CHANGED
@@ -79,10 +79,10 @@ module LazyApiDoc
|
|
79
79
|
File.write("#{path}/api.yml", layout.to_yaml)
|
80
80
|
end
|
81
81
|
|
82
|
-
def save_examples
|
82
|
+
def save_examples(process_name)
|
83
83
|
FileUtils.mkdir("#{path}/examples") unless File.exist?("#{path}/examples")
|
84
84
|
File.write(
|
85
|
-
"#{path}/examples
|
85
|
+
"#{path}/examples/#{process_name}_#{ENV['TEST_ENV_NUMBER'] || SecureRandom.uuid}.json",
|
86
86
|
{
|
87
87
|
created_at: Time.now.to_i,
|
88
88
|
examples: generator.examples
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdan Guban
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: The gem collects all requests and responses from your request specs and
|
14
14
|
generates documentationbased on it
|