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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e175b3015ed8ed1ad88ac14886ed8f9e3eabf14ee78cfb5f730f853d04772f4d
4
- data.tar.gz: 5447efa1957737f9cd8da1551b1e4d9379192ab2284fbdf36c35d2b8223cf14b
3
+ metadata.gz: 555390911c144982f0fd555e01ccf0b0a53452673e704085f3b29f63d23c74fb
4
+ data.tar.gz: 7b5d5e2e97f390c40f8dfc89a706aca36c124914e4bdf22a4f213f2c5ff6e093
5
5
  SHA512:
6
- metadata.gz: 9e2789445f60212e93667d3f0ef821f73950137f3b882255183085d145e677c52bb2740d4ee58927553c5152393f3fc28ad03d310c5e794aacafed1f87db3ef7
7
- data.tar.gz: 9f6acfa9631e14c38537ec92af554a65c7ad091bf33e71ef0cd10e258c1d9c63e6036537401866c3b9f33f2795b309bd265513288fb6fb30efe71de1e3364f1b
6
+ metadata.gz: c516ffc1f0d5114fbd6d0e176a021588604ac3bf91f57b7d49f63d99301ec30b6fb6cc5fa616992b2e696ac7b544193d7bfc62ff02934a12aaa8dcb037eac32b
7
+ data.tar.gz: 6d68990c8bfae2f9079ea022263a9ea05f57dc95bdac40a23940a5e5a1a0eb11be346ab4c93aff122193ab768e92b5b6a182aa6a708ef33efbf046b2809e542f
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  # Change log
2
2
 
3
+ ### 3.2.6 - 2024-12-08
4
+
5
+ * bug fixes
6
+ * fix null content-type for request OpenAPI 3
7
+
8
+ ### 3.2.5 - 2024-12-02
9
+
10
+ * bug fixes
11
+ * fix request json schema definitions for OpenAPI 3
12
+
3
13
  ### 3.2.4 - 2024-08-08
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: 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)
@@ -1,3 +1,3 @@
1
1
  module Tomograph
2
- VERSION = '3.2.4'.freeze
2
+ VERSION = '3.2.6'.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.4
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-07 00:00:00.000000000 Z
11
+ date: 2024-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: methadone