tomograph 3.2.4 → 3.2.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/tomograph/openapi/openapi2.rb +1 -0
- data/lib/tomograph/openapi/openapi3.rb +31 -1
- 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: 78d232066faa6723edc7bd4f7f0e3fe5f969a0a75594e0532462f1d094843099
|
4
|
+
data.tar.gz: 68ffafe21b3f7b67ee33f4d7dc177aa184ef6dae20cdc7645af87097ff0a6454
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac711a3a470990481526966fc4b79648ffc98bcec078139472613c6ff36ed3a5d42d60ee0ecca3bc60b91d89383707b32354e3c7558e144ff09012eec2499a7f
|
7
|
+
data.tar.gz: 48f0557dd893211c057957c81de3cf683acb2a4f5db44aec3664f52b58486c0312cde3dc71fb6b7e3728c90ac600efd129bc8eb11346491a137678bd9e5cae95
|
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
20
|
content_type: action_definition[method]['requestBody'] && action_definition[method]['requestBody']['content'].keys[0] == 'application/json' ? action_definition[method]['requestBody']['content'].keys[0] : '',
|
18
|
-
requests: [],
|
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)|
|
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.5
|
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-
|
11
|
+
date: 2024-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: methadone
|