swagui 0.4.0 → 0.4.1

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
  SHA1:
3
- metadata.gz: 5ada5af68f79789855e02b8739f466125d9281d6
4
- data.tar.gz: 5fab5cef417da06e01af99fbdadfb44fa87c097d
3
+ metadata.gz: 96796f626d96d5277a24f656bf40e6edbcb1609b
4
+ data.tar.gz: f4f429bf1cee4358b5e5fafd5dbbfdc6efe677fc
5
5
  SHA512:
6
- metadata.gz: 2724cf00bc4bf66c060829b45a0177c9c740d07bebeae0f97e16d45ef7153629a9cd192ec2289aed1cf819b2247eee7c77b1f187c6a27904428edb4466cc12f1
7
- data.tar.gz: 551f0eda01c8fd4a8006a697d9f5693a109074d3a09ce44d4fc1b8e42adb32fe52757cfe16726b7459ceb5bf3a3603561ff906e10421a4521d01b4b8c6cf45a8
6
+ metadata.gz: aa17d33e7927c59cdc493e12646a6f1d679a441887208b025d80e29e4fa3db682b40af8c73b391d4bc469e9b534ee40ea3bc502626874fcc8b31c79f91ab7584
7
+ data.tar.gz: 2e1507962d3e600d29fbaccd6e1b90e86497436a6de088b7cc6952360b35fb2388e1014d3a19bbf584beb39ea58abd4a4594d9e043dcf6c5ddd9bd6af65ed013
@@ -1,3 +1,3 @@
1
1
  module Swagui
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
@@ -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
- process_api_docs_api_listing(response_hash, response[2].path )
21
- process_schemas(response_hash)
22
- process_base_path(response_hash, response[2].path, env)
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 doc_path.end_with?('api-docs.yml') && response_hash['models'].nil? # requesting the root
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 !doc_path.end_with?('api-docs.yml') && response_hash['basePath'].nil?
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.0
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-16 00:00:00.000000000 Z
11
+ date: 2014-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rack