tomograph 3.1.5 → 3.2.0
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 +15 -0
- data/lib/tomograph/openapi/openapi3.rb +32 -23
- data/lib/tomograph/version.rb +1 -1
- data/tomograph.gemspec +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3325a247d67c5573ce732942f0ce962e286ff44df559ca20026834b70e541630
|
4
|
+
data.tar.gz: d3303b26448aeb89fd95d15b5d3958aaeca7fe30b8054ae31af22a8933774fb8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c3f659cf90f535c8c5cb17c4164a9d7e751930c4bd98575e67cec65f24aa9f832506c44f98c56013947806259945baa94a2a13785a7ff7a9cc0c97b32d26992
|
7
|
+
data.tar.gz: 2a9f4c82ccdd8c6e7c9ad1e52950a32401f48f056ce2199eaddb09ea6f347a37e5210cc030a1933bfb593b6cc5a23c6fa535fbd1df7726ea4170353d9e2f20f1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
# Change log
|
2
2
|
|
3
|
+
### 3.2.0 - 2024-01-13
|
4
|
+
|
5
|
+
* features
|
6
|
+
* support multiple content types for response with one code for OpenAPI 3.0
|
7
|
+
* bug fixes
|
8
|
+
* allow responses with empty bodies for OpenAPI 3.0
|
9
|
+
* refactoring
|
10
|
+
* small renamings for easier reading for OpenAPI 3.0
|
11
|
+
* do not pass around documentation schemas object for OpenAPI 3.0
|
12
|
+
|
13
|
+
### 3.1.6 - 2023-10-06
|
14
|
+
|
15
|
+
* patch
|
16
|
+
* change home page
|
17
|
+
|
3
18
|
### 3.1.5 - 2023-02-02
|
4
19
|
|
5
20
|
* bug fixes
|
@@ -9,46 +9,55 @@ module Tomograph
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def to_tomogram
|
12
|
-
@tomogram ||= @documentation['paths'].each_with_object([]) do |
|
13
|
-
|
12
|
+
@tomogram ||= @documentation['paths'].each_with_object([]) do |(path, action_definition), result|
|
13
|
+
action_definition.keys.each do |method|
|
14
14
|
result.push(Tomograph::Tomogram::Action.new(
|
15
|
-
path: "#{@prefix}#{
|
15
|
+
path: "#{@prefix}#{path}",
|
16
16
|
method: method.upcase,
|
17
17
|
content_type: '',
|
18
18
|
requests: [],
|
19
|
-
responses: responses(
|
19
|
+
responses: responses(action_definition[method]['responses']),
|
20
20
|
resource: ''
|
21
21
|
))
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
-
def responses(
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
26
|
+
def responses(responses_definitions)
|
27
|
+
result = []
|
28
|
+
responses_definitions.each do |(response_code, response)|
|
29
|
+
# response can be either Response Object or Reference Object
|
30
|
+
if response.key?('$ref')
|
31
|
+
response_description_path = response['$ref'].split('/')[1..] # first one is a '#'
|
32
|
+
response['content'] = @documentation.dig(*response_description_path)['content']
|
33
|
+
end
|
34
|
+
|
35
|
+
# Content can be nil if response body is not provided
|
36
|
+
if response['content'].nil?
|
36
37
|
result.push(
|
37
|
-
'status' =>
|
38
|
-
'body'
|
39
|
-
'content-type' => '
|
38
|
+
'status' => response_code,
|
39
|
+
'body'=> {},
|
40
|
+
'content-type' => ''
|
40
41
|
)
|
41
42
|
else
|
42
|
-
result
|
43
|
-
status: response[0],
|
44
|
-
body: {},
|
45
|
-
'content-type': ''
|
46
|
-
)
|
43
|
+
result += responses_by_content_types(response['content'], response_code)
|
47
44
|
end
|
48
45
|
end
|
46
|
+
result
|
47
|
+
end
|
48
|
+
|
49
|
+
def responses_by_content_types(content_types, response_code)
|
50
|
+
content_types.map do |content_type, media_type_obj|
|
51
|
+
{
|
52
|
+
'status' => response_code,
|
53
|
+
'body' => schema(media_type_obj['schema']),
|
54
|
+
'content-type' => content_type
|
55
|
+
}
|
56
|
+
end
|
49
57
|
end
|
50
58
|
|
51
|
-
def schema(sche
|
59
|
+
def schema(sche)
|
60
|
+
defi = @documentation['components']['schemas']
|
52
61
|
if sche.keys.include?('$ref')
|
53
62
|
sche.merge!('components' => {})
|
54
63
|
sche['components'].merge!('schemas' => {})
|
data/lib/tomograph/version.rb
CHANGED
data/tomograph.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = 'Convert API Blueprint, Swagger and OpenAPI to Tomogram'
|
12
12
|
spec.description = 'Convert API Blueprint, Swagger and OpenAPI to routes and JSON-Schemas'
|
13
|
-
spec.homepage = 'https://github.com/
|
13
|
+
spec.homepage = 'https://github.com/matchtechnologies/tomograph'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
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.
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- d.efimov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: methadone
|
@@ -180,7 +180,7 @@ files:
|
|
180
180
|
- lib/tomograph/version.rb
|
181
181
|
- script/update_json_fixtures
|
182
182
|
- tomograph.gemspec
|
183
|
-
homepage: https://github.com/
|
183
|
+
homepage: https://github.com/matchtechnologies/tomograph
|
184
184
|
licenses:
|
185
185
|
- MIT
|
186
186
|
metadata: {}
|