tomograph 3.2.4 → 3.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/CHANGELOG.md +10 -0
- data/lib/tomograph/openapi/openapi2.rb +1 -0
- data/lib/tomograph/openapi/openapi3.rb +33 -3
- data/lib/tomograph/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 555390911c144982f0fd555e01ccf0b0a53452673e704085f3b29f63d23c74fb
|
4
|
+
data.tar.gz: 7b5d5e2e97f390c40f8dfc89a706aca36c124914e4bdf22a4f213f2c5ff6e093
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c516ffc1f0d5114fbd6d0e176a021588604ac3bf91f57b7d49f63d99301ec30b6fb6cc5fa616992b2e696ac7b544193d7bfc62ff02934a12aaa8dcb037eac32b
|
7
|
+
data.tar.gz: 6d68990c8bfae2f9079ea022263a9ea05f57dc95bdac40a23940a5e5a1a0eb11be346ab4c93aff122193ab768e92b5b6a182aa6a708ef33efbf046b2809e542f
|
data/CHANGELOG.md
CHANGED
@@ -12,6 +12,7 @@ module Tomograph
|
|
12
12
|
@tomogram ||= @documentation['paths'].each_with_object([]) do |action, result|
|
13
13
|
action[1].keys.each do |method|
|
14
14
|
next result if method == 'parameters'
|
15
|
+
|
15
16
|
result.push(Tomograph::Tomogram::Action.new(
|
16
17
|
path: "#{@prefix}#{action[0]}",
|
17
18
|
method: method.upcase,
|
@@ -11,11 +11,14 @@ module Tomograph
|
|
11
11
|
def to_tomogram
|
12
12
|
@tomogram ||= @documentation['paths'].each_with_object([]) do |(path, action_definition), result|
|
13
13
|
action_definition.keys.each do |method|
|
14
|
+
ajj = valuekey(action_definition[method]['requestBody'], 'content')
|
15
|
+
aj = valuekey(ajj, 'application/json')
|
16
|
+
|
14
17
|
result.push(Tomograph::Tomogram::Action.new(
|
15
18
|
path: "#{@prefix}#{path}",
|
16
19
|
method: method.upcase,
|
17
|
-
content_type: action_definition[method]['requestBody'] && action_definition[method]['requestBody']['content'].keys[0] == 'application/json' ? action_definition[method]['requestBody']['content'].keys[0] :
|
18
|
-
requests: [],
|
20
|
+
content_type: action_definition[method]['requestBody'] && action_definition[method]['requestBody']['content'].keys[0] == 'application/json' ? action_definition[method]['requestBody']['content'].keys[0] : nil,
|
21
|
+
requests: [schema_new(valuekey(aj, 'schema'), @documentation['definitions'])].compact,
|
19
22
|
responses: responses(action_definition[method]['responses']),
|
20
23
|
resource: ''
|
21
24
|
))
|
@@ -23,6 +26,33 @@ module Tomograph
|
|
23
26
|
end
|
24
27
|
end
|
25
28
|
|
29
|
+
def valuekey(value, key)
|
30
|
+
value.nil? ? nil : value[key]
|
31
|
+
end
|
32
|
+
|
33
|
+
def schema_new(sche, defi)
|
34
|
+
return sche unless sche
|
35
|
+
if sche.keys.include?('$ref')
|
36
|
+
res = sche.merge('definitions' => { sche['$ref'][14..-1] => defi[sche['$ref'][14..-1]] })
|
37
|
+
if defi[sche['$ref'][14..-1]].to_s.include?('$ref')
|
38
|
+
keys = defi[sche['$ref'][14..-1]].to_s.split('"').find_all { |word| word.include?('definitions') }
|
39
|
+
keys.each do |key|
|
40
|
+
res['definitions'].merge!({ key[14..-1] => defi[key[14..-1]] })
|
41
|
+
end
|
42
|
+
end
|
43
|
+
res
|
44
|
+
elsif sche.to_s.include?('$ref')
|
45
|
+
res = sche.merge('definitions' => {})
|
46
|
+
keys = sche.to_s.split('"').find_all { |word| word.include?('definitions') }
|
47
|
+
keys.each do |key|
|
48
|
+
res['definitions'].merge!({ key[14..-1] => defi[key[14..-1]] })
|
49
|
+
end
|
50
|
+
res
|
51
|
+
else
|
52
|
+
sche
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
26
56
|
def responses(responses_definitions)
|
27
57
|
result = []
|
28
58
|
responses_definitions.each do |(response_code, response)|
|
@@ -37,7 +67,7 @@ module Tomograph
|
|
37
67
|
result.push(
|
38
68
|
'status' => response_code,
|
39
69
|
'body'=> {},
|
40
|
-
'content-type' =>
|
70
|
+
'content-type' => nil
|
41
71
|
)
|
42
72
|
else
|
43
73
|
result += responses_by_content_types(response['content'], response_code)
|
data/lib/tomograph/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tomograph
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- d.efimov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08
|
11
|
+
date: 2024-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: methadone
|