swagui 0.4.0 → 0.4.1
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/lib/swagui/version.rb +1 -1
- data/lib/swagui/yaml_doc_handler.rb +11 -6
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 96796f626d96d5277a24f656bf40e6edbcb1609b
|
|
4
|
+
data.tar.gz: f4f429bf1cee4358b5e5fafd5dbbfdc6efe677fc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa17d33e7927c59cdc493e12646a6f1d679a441887208b025d80e29e4fa3db682b40af8c73b391d4bc469e9b534ee40ea3bc502626874fcc8b31c79f91ab7584
|
|
7
|
+
data.tar.gz: 2e1507962d3e600d29fbaccd6e1b90e86497436a6de088b7cc6952360b35fb2388e1014d3a19bbf584beb39ea58abd4a4594d9e043dcf6c5ddd9bd6af65ed013
|
data/lib/swagui/version.rb
CHANGED
|
@@ -17,9 +17,12 @@ module Swagui
|
|
|
17
17
|
body = []
|
|
18
18
|
response[2].each do |f|
|
|
19
19
|
body << YAML::load(f).tap do |response_hash|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
if response[2].path.end_with?('api-docs.yml')
|
|
21
|
+
process_api_docs_api_listing(response_hash, response[2].path )
|
|
22
|
+
else
|
|
23
|
+
process_schemas(response_hash)
|
|
24
|
+
process_base_path(response_hash, response[2].path, env)
|
|
25
|
+
end
|
|
23
26
|
end.to_json
|
|
24
27
|
end
|
|
25
28
|
|
|
@@ -37,6 +40,9 @@ module Swagui
|
|
|
37
40
|
end
|
|
38
41
|
|
|
39
42
|
def process_schemas(response_hash)
|
|
43
|
+
|
|
44
|
+
deep_merge!(response_hash, @api_json_template) if @api_json_template
|
|
45
|
+
|
|
40
46
|
(response_hash['apis'] || []).each do |api_hash|
|
|
41
47
|
(api_hash['operations'] || []).each do |operations_hash|
|
|
42
48
|
operation_name = operations_hash['nickname']
|
|
@@ -52,7 +58,6 @@ module Swagui
|
|
|
52
58
|
end
|
|
53
59
|
end
|
|
54
60
|
end
|
|
55
|
-
deep_merge!(response_hash, @api_json_template) if @api_json_template
|
|
56
61
|
end
|
|
57
62
|
|
|
58
63
|
def merge_schema!(parent_hash, response_hash, name, response_model = false)
|
|
@@ -75,7 +80,7 @@ module Swagui
|
|
|
75
80
|
end
|
|
76
81
|
|
|
77
82
|
def process_api_docs_api_listing(response_hash, doc_path)
|
|
78
|
-
if
|
|
83
|
+
if response_hash['models'].nil? # requesting the root
|
|
79
84
|
|
|
80
85
|
@api_json_template = response_hash.delete('template')
|
|
81
86
|
|
|
@@ -90,7 +95,7 @@ module Swagui
|
|
|
90
95
|
end
|
|
91
96
|
|
|
92
97
|
def process_base_path(response_hash, doc_path, env)
|
|
93
|
-
if
|
|
98
|
+
if response_hash['basePath'].nil?
|
|
94
99
|
request = Rack::Request.new(env)
|
|
95
100
|
response_hash['basePath'] = (request.base_url + request.script_name)
|
|
96
101
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: swagui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.4.
|
|
4
|
+
version: 0.4.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Jack Xu
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-10-
|
|
11
|
+
date: 2014-10-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rack
|