tomograph 3.2.3 → 3.2.5

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: dc85d4bf90afd51b699b6685ef8b55beb207e2d9da234ef69a0d878f084e72ec
4
- data.tar.gz: c5ac1d75deaa358b507442e6e429ad0e66af5e9641d8bb604591aa1e55342cfd
3
+ metadata.gz: 78d232066faa6723edc7bd4f7f0e3fe5f969a0a75594e0532462f1d094843099
4
+ data.tar.gz: 68ffafe21b3f7b67ee33f4d7dc177aa184ef6dae20cdc7645af87097ff0a6454
5
5
  SHA512:
6
- metadata.gz: e9f34fb27300d17df46781032bd83bb5a48de8d12ffd0f293dbb1f64163145d598592769b34fa65dd6f288a8e12459d4d70ee335fdd9e8438c825f79d395e91e
7
- data.tar.gz: c0eb8517d6428198b9cf0ac00fb7d8ae90cbc6f87e3bfd83e896157d1001d2868bfcc72348506a68dca2fc9a0cf020b26a979888daf9526f3a684289a10836da
6
+ metadata.gz: ac711a3a470990481526966fc4b79648ffc98bcec078139472613c6ff36ed3a5d42d60ee0ecca3bc60b91d89383707b32354e3c7558e144ff09012eec2499a7f
7
+ data.tar.gz: 48f0557dd893211c057957c81de3cf683acb2a4f5db44aec3664f52b58486c0312cde3dc71fb6b7e3728c90ac600efd129bc8eb11346491a137678bd9e5cae95
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Change log
2
2
 
3
+ ### 3.2.5 - 2024-12-02
4
+
5
+ * bug fixes
6
+ * fix request json schema definitions for OpenAPI 3
7
+
8
+ ### 3.2.4 - 2024-08-08
9
+
10
+ * bug fixes
11
+ * fix content type for open api for request
12
+
3
13
  ### 3.2.3 - 2024-05-28
4
14
 
5
15
  * bug fixes
@@ -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: '',
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] : '',
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)|
@@ -1,3 +1,3 @@
1
1
  module Tomograph
2
- VERSION = '3.2.3'.freeze
2
+ VERSION = '3.2.5'.freeze
3
3
  end
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.3
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-05-27 00:00:00.000000000 Z
11
+ date: 2024-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: methadone