rswag-ui 1.6.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/rswag/ui/custom/custom_generator.rb +2 -2
- data/lib/generators/rswag/ui/install/templates/rswag-ui.rb +1 -0
- data/lib/rswag/ui/configuration.rb +22 -4
- data/lib/rswag/ui/engine.rb +7 -10
- data/lib/rswag/ui/index.erb +103 -0
- data/lib/rswag/ui/middleware.rb +44 -0
- data/lib/tasks/rswag-ui_tasks.rake +12 -0
- metadata +6 -56
- data/app/controllers/rswag/ui/home_controller.rb +0 -11
- data/app/views/rswag/ui/home/index.html.erb +0 -126
- data/config/routes.rb +0 -3
- data/vendor/assets/components/swagger-ui/css/print.css.erb +0 -1367
- data/vendor/assets/components/swagger-ui/css/reset.css +0 -125
- data/vendor/assets/components/swagger-ui/css/screen.css.erb +0 -1494
- data/vendor/assets/components/swagger-ui/css/style.css.erb +0 -250
- data/vendor/assets/components/swagger-ui/css/typography.css.erb +0 -14
- data/vendor/assets/components/swagger-ui/fonts/DroidSans-Bold.ttf +0 -0
- data/vendor/assets/components/swagger-ui/fonts/DroidSans.ttf +0 -0
- data/vendor/assets/components/swagger-ui/images/collapse.gif +0 -0
- data/vendor/assets/components/swagger-ui/images/expand.gif +0 -0
- data/vendor/assets/components/swagger-ui/images/explorer_icons.png +0 -0
- data/vendor/assets/components/swagger-ui/images/favicon-16x16.png +0 -0
- data/vendor/assets/components/swagger-ui/images/favicon-32x32.png +0 -0
- data/vendor/assets/components/swagger-ui/images/favicon.ico +0 -0
- data/vendor/assets/components/swagger-ui/images/logo_small.png +0 -0
- data/vendor/assets/components/swagger-ui/images/pet_store_api.png +0 -0
- data/vendor/assets/components/swagger-ui/images/throbber.gif +0 -0
- data/vendor/assets/components/swagger-ui/images/wordnik_api.png +0 -0
- data/vendor/assets/components/swagger-ui/lang/ca.js +0 -53
- data/vendor/assets/components/swagger-ui/lang/en.js +0 -56
- data/vendor/assets/components/swagger-ui/lang/es.js +0 -53
- data/vendor/assets/components/swagger-ui/lang/fr.js +0 -54
- data/vendor/assets/components/swagger-ui/lang/geo.js +0 -56
- data/vendor/assets/components/swagger-ui/lang/it.js +0 -52
- data/vendor/assets/components/swagger-ui/lang/ja.js +0 -53
- data/vendor/assets/components/swagger-ui/lang/ko-kr.js +0 -53
- data/vendor/assets/components/swagger-ui/lang/pl.js +0 -53
- data/vendor/assets/components/swagger-ui/lang/pt.js +0 -53
- data/vendor/assets/components/swagger-ui/lang/ru.js +0 -56
- data/vendor/assets/components/swagger-ui/lang/tr.js +0 -53
- data/vendor/assets/components/swagger-ui/lang/translator.js +0 -39
- data/vendor/assets/components/swagger-ui/lang/zh-cn.js +0 -53
- data/vendor/assets/components/swagger-ui/lib/backbone-min.js +0 -15
- data/vendor/assets/components/swagger-ui/lib/es5-shim.js +0 -2065
- data/vendor/assets/components/swagger-ui/lib/handlebars-4.0.5.js +0 -4608
- data/vendor/assets/components/swagger-ui/lib/highlight.9.1.0.pack.js +0 -2
- data/vendor/assets/components/swagger-ui/lib/highlight.9.1.0.pack_extended.js +0 -34
- data/vendor/assets/components/swagger-ui/lib/jquery-1.8.0.min.js +0 -2
- data/vendor/assets/components/swagger-ui/lib/jquery.ba-bbq.min.js +0 -18
- data/vendor/assets/components/swagger-ui/lib/jquery.slideto.min.js +0 -1
- data/vendor/assets/components/swagger-ui/lib/jquery.wiggle.min.js +0 -8
- data/vendor/assets/components/swagger-ui/lib/js-yaml.min.js +0 -3
- data/vendor/assets/components/swagger-ui/lib/jsoneditor.min.js +0 -11
- data/vendor/assets/components/swagger-ui/lib/lodash.min.js +0 -102
- data/vendor/assets/components/swagger-ui/lib/marked.js +0 -1272
- data/vendor/assets/components/swagger-ui/lib/object-assign-pollyfill.js +0 -23
- data/vendor/assets/components/swagger-ui/lib/sanitize-html.min.js +0 -6
- data/vendor/assets/components/swagger-ui/lib/swagger-oauth.js +0 -347
- data/vendor/assets/components/swagger-ui/o2c.html +0 -20
- data/vendor/assets/components/swagger-ui/swagger-ui.js +0 -24993
- data/vendor/assets/components/swagger-ui/swagger-ui.min.js +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0ef5c28b235cad0e1e0209a710e43f1b061509a947792c26e69a56f9f366be3b
|
4
|
+
data.tar.gz: ce7ac5d67c50e5b11f6bf4aadc75d73aefdb3a95401c9e7e0e38b4919f534c7b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29ae516901143f7032353171928c69c8164e6fbd36a4ebb7385cc69e1cc6d3a49b5ef160c3d9fcb21562983344f0253e2fff5d741aadece63a98472a522ced34
|
7
|
+
data.tar.gz: bb10473e1f3d883b9cd9d2a590b39d3ddf2141f2b4f285cda10abf6ad12c7ad3274e1984a18cb6baf17597ee0f89eea31d1b63308cd1bfb31da8a6d51f208d4f
|
@@ -3,10 +3,10 @@ require 'rails/generators'
|
|
3
3
|
module Rswag
|
4
4
|
module Ui
|
5
5
|
class CustomGenerator < Rails::Generators::Base
|
6
|
-
source_root File.expand_path('../../../../../../
|
6
|
+
source_root File.expand_path('../../../../../../lib/rswag/ui', __FILE__)
|
7
7
|
|
8
8
|
def add_custom_index
|
9
|
-
copy_file('index.
|
9
|
+
copy_file('index.erb', 'app/views/rswag/ui/home/index.html.erb')
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -5,5 +5,6 @@ Rswag::Ui.configure do |c|
|
|
5
5
|
# JSON endpoint and the second is a title that will be displayed in the document selector
|
6
6
|
# NOTE: If you're using rspec-api to expose Swagger files (under swagger_root) as JSON endpoints,
|
7
7
|
# then the list below should correspond to the relative paths for those endpoints
|
8
|
+
|
8
9
|
c.swagger_endpoint '/api-docs/v1/swagger.json', 'API V1 Docs'
|
9
10
|
end
|
@@ -3,14 +3,32 @@ require 'ostruct'
|
|
3
3
|
module Rswag
|
4
4
|
module Ui
|
5
5
|
class Configuration
|
6
|
-
attr_reader :
|
6
|
+
attr_reader :template_locations
|
7
|
+
attr_accessor :config_object
|
8
|
+
attr_accessor :oauth_config_object
|
9
|
+
attr_reader :assets_root
|
7
10
|
|
8
11
|
def initialize
|
9
|
-
@
|
12
|
+
@template_locations = [
|
13
|
+
# preffered override location
|
14
|
+
"#{Rack::Directory.new('').root}/swagger/index.erb",
|
15
|
+
# backwards compatible override location
|
16
|
+
"#{Rack::Directory.new('').root}/app/views/rswag/ui/home/index.html.erb",
|
17
|
+
# default location
|
18
|
+
File.expand_path('../index.erb', __FILE__)
|
19
|
+
]
|
20
|
+
@assets_root = File.expand_path('../../../../node_modules/swagger-ui-dist', __FILE__)
|
21
|
+
@config_object = {}
|
22
|
+
@oauth_config_object = {}
|
10
23
|
end
|
11
24
|
|
12
|
-
def swagger_endpoint(
|
13
|
-
@
|
25
|
+
def swagger_endpoint(url, name)
|
26
|
+
@config_object[:urls] ||= []
|
27
|
+
@config_object[:urls] << { url: url, name: name }
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_binding
|
31
|
+
binding
|
14
32
|
end
|
15
33
|
end
|
16
34
|
end
|
data/lib/rswag/ui/engine.rb
CHANGED
@@ -1,19 +1,16 @@
|
|
1
|
+
require 'rswag/ui/middleware'
|
2
|
+
|
1
3
|
module Rswag
|
2
4
|
module Ui
|
3
5
|
class Engine < ::Rails::Engine
|
4
6
|
isolate_namespace Rswag::Ui
|
5
7
|
|
6
8
|
initializer 'rswag-ui.initialize' do |app|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
'swagger-ui/lang/*',
|
13
|
-
'swagger-ui/lib/*',
|
14
|
-
'swagger-ui/swagger-ui.min.js'
|
15
|
-
]
|
16
|
-
end
|
9
|
+
middleware.use Rswag::Ui::Middleware, Rswag::Ui.config
|
10
|
+
end
|
11
|
+
|
12
|
+
rake_tasks do
|
13
|
+
load File.expand_path('../../../tasks/rswag-ui_tasks.rake', __FILE__)
|
17
14
|
end
|
18
15
|
end
|
19
16
|
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
<!-- HTML for static distribution bundle build -->
|
2
|
+
<!DOCTYPE html>
|
3
|
+
<html lang="en">
|
4
|
+
<head>
|
5
|
+
<meta charset="UTF-8">
|
6
|
+
<title>Swagger UI</title>
|
7
|
+
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
|
8
|
+
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
|
9
|
+
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
10
|
+
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
11
|
+
<style>
|
12
|
+
html
|
13
|
+
{
|
14
|
+
box-sizing: border-box;
|
15
|
+
overflow: -moz-scrollbars-vertical;
|
16
|
+
overflow-y: scroll;
|
17
|
+
}
|
18
|
+
*,
|
19
|
+
*:before,
|
20
|
+
*:after
|
21
|
+
{
|
22
|
+
box-sizing: inherit;
|
23
|
+
}
|
24
|
+
|
25
|
+
body {
|
26
|
+
margin:0;
|
27
|
+
background: #fafafa;
|
28
|
+
}
|
29
|
+
</style>
|
30
|
+
</head>
|
31
|
+
|
32
|
+
<body>
|
33
|
+
|
34
|
+
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
|
35
|
+
<defs>
|
36
|
+
<symbol viewBox="0 0 20 20" id="unlocked">
|
37
|
+
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
|
38
|
+
</symbol>
|
39
|
+
|
40
|
+
<symbol viewBox="0 0 20 20" id="locked">
|
41
|
+
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
|
42
|
+
</symbol>
|
43
|
+
|
44
|
+
<symbol viewBox="0 0 20 20" id="close">
|
45
|
+
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
|
46
|
+
</symbol>
|
47
|
+
|
48
|
+
<symbol viewBox="0 0 20 20" id="large-arrow">
|
49
|
+
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
|
50
|
+
</symbol>
|
51
|
+
|
52
|
+
<symbol viewBox="0 0 20 20" id="large-arrow-down">
|
53
|
+
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
|
54
|
+
</symbol>
|
55
|
+
|
56
|
+
|
57
|
+
<symbol viewBox="0 0 24 24" id="jump-to">
|
58
|
+
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
|
59
|
+
</symbol>
|
60
|
+
|
61
|
+
<symbol viewBox="0 0 24 24" id="expand">
|
62
|
+
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
63
|
+
</symbol>
|
64
|
+
|
65
|
+
</defs>
|
66
|
+
</svg>
|
67
|
+
|
68
|
+
<div id="swagger-ui"></div>
|
69
|
+
|
70
|
+
<!-- Workaround for https://github.com/swagger-api/swagger-editor/issues/1371 -->
|
71
|
+
<script>
|
72
|
+
if (window.navigator.userAgent.indexOf("Edge") > -1) {
|
73
|
+
console.log("Removing native Edge fetch in favor of swagger-ui's polyfill")
|
74
|
+
window.fetch = undefined;
|
75
|
+
}
|
76
|
+
</script>
|
77
|
+
|
78
|
+
<script src="./swagger-ui-bundle.js"> </script>
|
79
|
+
<script src="./swagger-ui-standalone-preset.js"> </script>
|
80
|
+
<script>
|
81
|
+
window.onload = function () {
|
82
|
+
var configObject = JSON.parse('<%= config_object.to_json %>');
|
83
|
+
var oauthConfigObject = JSON.parse('<%= oauth_config_object.to_json %>');
|
84
|
+
|
85
|
+
// Apply mandatory parameters
|
86
|
+
configObject.dom_id = "#swagger-ui";
|
87
|
+
configObject.presets = [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset];
|
88
|
+
configObject.layout = "StandaloneLayout";
|
89
|
+
|
90
|
+
// If oauth2RedirectUrl isn't specified, use the built-in default
|
91
|
+
if (!configObject.hasOwnProperty("oauth2RedirectUrl"))
|
92
|
+
configObject.oauth2RedirectUrl = window.location.href.replace("index.html", "oauth2-redirect.html");
|
93
|
+
|
94
|
+
// Build a system
|
95
|
+
const ui = SwaggerUIBundle(configObject);
|
96
|
+
|
97
|
+
// Apply OAuth config
|
98
|
+
ui.initOAuth(oauthConfigObject);
|
99
|
+
}
|
100
|
+
</script>
|
101
|
+
</body>
|
102
|
+
|
103
|
+
</html>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Rswag
|
2
|
+
module Ui
|
3
|
+
class Middleware < Rack::Static
|
4
|
+
|
5
|
+
def initialize(app, config)
|
6
|
+
@config = config
|
7
|
+
super(app, urls: [ '' ], root: config.assets_root )
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
if base_path?(env)
|
12
|
+
redirect_uri = env['SCRIPT_NAME'].chomp('/') + '/index.html'
|
13
|
+
return [ 301, { 'Location' => redirect_uri }, [ ] ]
|
14
|
+
end
|
15
|
+
|
16
|
+
if index_path?(env)
|
17
|
+
return [ 200, { 'Content-Type' => 'text/html' }, [ render_template ] ]
|
18
|
+
end
|
19
|
+
|
20
|
+
super
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def base_path?(env)
|
26
|
+
env['REQUEST_METHOD'] == "GET" && env['PATH_INFO'] == "/"
|
27
|
+
end
|
28
|
+
|
29
|
+
def index_path?(env)
|
30
|
+
env['REQUEST_METHOD'] == "GET" && env['PATH_INFO'] == "/index.html"
|
31
|
+
end
|
32
|
+
|
33
|
+
def render_template
|
34
|
+
file = File.new(template_filename)
|
35
|
+
template = ERB.new(file.read)
|
36
|
+
template.result(@config.get_binding)
|
37
|
+
end
|
38
|
+
|
39
|
+
def template_filename
|
40
|
+
@config.template_locations.find { |filename| File.exists?(filename) }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
namespace :rswag do
|
2
|
+
namespace :ui do
|
3
|
+
|
4
|
+
desc 'TODO'
|
5
|
+
task :copy_assets, [ :dest ] do |t, args|
|
6
|
+
dest = args[:dest]
|
7
|
+
FileUtils.rm_r(dest, force: true)
|
8
|
+
FileUtils.mkdir_p(dest)
|
9
|
+
FileUtils.cp_r(Dir.glob("#{Rswag::Ui.config.assets_root}/{*.js,*.png,*.css}"), dest)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rswag-ui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richie Morris
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-05-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -60,9 +60,6 @@ extra_rdoc_files: []
|
|
60
60
|
files:
|
61
61
|
- MIT-LICENSE
|
62
62
|
- Rakefile
|
63
|
-
- app/controllers/rswag/ui/home_controller.rb
|
64
|
-
- app/views/rswag/ui/home/index.html.erb
|
65
|
-
- config/routes.rb
|
66
63
|
- lib/generators/rswag/ui/custom/USAGE
|
67
64
|
- lib/generators/rswag/ui/custom/custom_generator.rb
|
68
65
|
- lib/generators/rswag/ui/install/USAGE
|
@@ -71,56 +68,9 @@ files:
|
|
71
68
|
- lib/rswag/ui.rb
|
72
69
|
- lib/rswag/ui/configuration.rb
|
73
70
|
- lib/rswag/ui/engine.rb
|
74
|
-
-
|
75
|
-
-
|
76
|
-
-
|
77
|
-
- vendor/assets/components/swagger-ui/css/style.css.erb
|
78
|
-
- vendor/assets/components/swagger-ui/css/typography.css.erb
|
79
|
-
- vendor/assets/components/swagger-ui/fonts/DroidSans-Bold.ttf
|
80
|
-
- vendor/assets/components/swagger-ui/fonts/DroidSans.ttf
|
81
|
-
- vendor/assets/components/swagger-ui/images/collapse.gif
|
82
|
-
- vendor/assets/components/swagger-ui/images/expand.gif
|
83
|
-
- vendor/assets/components/swagger-ui/images/explorer_icons.png
|
84
|
-
- vendor/assets/components/swagger-ui/images/favicon-16x16.png
|
85
|
-
- vendor/assets/components/swagger-ui/images/favicon-32x32.png
|
86
|
-
- vendor/assets/components/swagger-ui/images/favicon.ico
|
87
|
-
- vendor/assets/components/swagger-ui/images/logo_small.png
|
88
|
-
- vendor/assets/components/swagger-ui/images/pet_store_api.png
|
89
|
-
- vendor/assets/components/swagger-ui/images/throbber.gif
|
90
|
-
- vendor/assets/components/swagger-ui/images/wordnik_api.png
|
91
|
-
- vendor/assets/components/swagger-ui/lang/ca.js
|
92
|
-
- vendor/assets/components/swagger-ui/lang/en.js
|
93
|
-
- vendor/assets/components/swagger-ui/lang/es.js
|
94
|
-
- vendor/assets/components/swagger-ui/lang/fr.js
|
95
|
-
- vendor/assets/components/swagger-ui/lang/geo.js
|
96
|
-
- vendor/assets/components/swagger-ui/lang/it.js
|
97
|
-
- vendor/assets/components/swagger-ui/lang/ja.js
|
98
|
-
- vendor/assets/components/swagger-ui/lang/ko-kr.js
|
99
|
-
- vendor/assets/components/swagger-ui/lang/pl.js
|
100
|
-
- vendor/assets/components/swagger-ui/lang/pt.js
|
101
|
-
- vendor/assets/components/swagger-ui/lang/ru.js
|
102
|
-
- vendor/assets/components/swagger-ui/lang/tr.js
|
103
|
-
- vendor/assets/components/swagger-ui/lang/translator.js
|
104
|
-
- vendor/assets/components/swagger-ui/lang/zh-cn.js
|
105
|
-
- vendor/assets/components/swagger-ui/lib/backbone-min.js
|
106
|
-
- vendor/assets/components/swagger-ui/lib/es5-shim.js
|
107
|
-
- vendor/assets/components/swagger-ui/lib/handlebars-4.0.5.js
|
108
|
-
- vendor/assets/components/swagger-ui/lib/highlight.9.1.0.pack.js
|
109
|
-
- vendor/assets/components/swagger-ui/lib/highlight.9.1.0.pack_extended.js
|
110
|
-
- vendor/assets/components/swagger-ui/lib/jquery-1.8.0.min.js
|
111
|
-
- vendor/assets/components/swagger-ui/lib/jquery.ba-bbq.min.js
|
112
|
-
- vendor/assets/components/swagger-ui/lib/jquery.slideto.min.js
|
113
|
-
- vendor/assets/components/swagger-ui/lib/jquery.wiggle.min.js
|
114
|
-
- vendor/assets/components/swagger-ui/lib/js-yaml.min.js
|
115
|
-
- vendor/assets/components/swagger-ui/lib/jsoneditor.min.js
|
116
|
-
- vendor/assets/components/swagger-ui/lib/lodash.min.js
|
117
|
-
- vendor/assets/components/swagger-ui/lib/marked.js
|
118
|
-
- vendor/assets/components/swagger-ui/lib/object-assign-pollyfill.js
|
119
|
-
- vendor/assets/components/swagger-ui/lib/sanitize-html.min.js
|
120
|
-
- vendor/assets/components/swagger-ui/lib/swagger-oauth.js
|
121
|
-
- vendor/assets/components/swagger-ui/o2c.html
|
122
|
-
- vendor/assets/components/swagger-ui/swagger-ui.js
|
123
|
-
- vendor/assets/components/swagger-ui/swagger-ui.min.js
|
71
|
+
- lib/rswag/ui/index.erb
|
72
|
+
- lib/rswag/ui/middleware.rb
|
73
|
+
- lib/tasks/rswag-ui_tasks.rake
|
124
74
|
homepage: https://github.com/domaindrivendev/rswag
|
125
75
|
licenses:
|
126
76
|
- MIT
|
@@ -141,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
141
91
|
version: '0'
|
142
92
|
requirements: []
|
143
93
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.7.
|
94
|
+
rubygems_version: 2.7.7
|
145
95
|
signing_key:
|
146
96
|
specification_version: 4
|
147
97
|
summary: A Rails Engine that includes swagger-ui and powers it from configured Swagger
|
@@ -1,126 +0,0 @@
|
|
1
|
-
<!DOCTYPE html>
|
2
|
-
<html>
|
3
|
-
<head>
|
4
|
-
<meta charset="UTF-8">
|
5
|
-
<title>Swagger UI</title>
|
6
|
-
<link rel="icon" type="image/png" href="<%= asset_path 'swagger-ui/images/favicon-32x32.png' %>" sizes="32x32" />
|
7
|
-
<link rel="icon" type="image/png" href="<%= asset_path 'swagger-ui/images/favicon-16x16.png' %>" sizes="16x16" />
|
8
|
-
<link href="<%= asset_path 'swagger-ui/css/typography.css' %>" media='screen' rel='stylesheet' type='text/css'/>
|
9
|
-
<link href="<%= asset_path 'swagger-ui/css/reset.css' %>" media='screen' rel='stylesheet' type='text/css'/>
|
10
|
-
<link href="<%= asset_path 'swagger-ui/css/screen.css' %>" media='screen' rel='stylesheet' type='text/css'/>
|
11
|
-
<link href="<%= asset_path 'swagger-ui/css/reset.css' %>" media='print' rel='stylesheet' type='text/css'/>
|
12
|
-
<link href="<%= asset_path 'swagger-ui/css/print.css' %>" media='print' rel='stylesheet' type='text/css'/>
|
13
|
-
|
14
|
-
<script src="<%= asset_path 'swagger-ui/lib/object-assign-pollyfill.js' %>" type='text/javascript'></script>
|
15
|
-
<script src="<%= asset_path 'swagger-ui/lib/jquery-1.8.0.min.js' %>" type='text/javascript'></script>
|
16
|
-
<script src="<%= asset_path 'swagger-ui/lib/jquery.slideto.min.js' %>" type='text/javascript'></script>
|
17
|
-
<script src="<%= asset_path 'swagger-ui/lib/jquery.wiggle.min.js' %>" type='text/javascript'></script>
|
18
|
-
<script src="<%= asset_path 'swagger-ui/lib/jquery.ba-bbq.min.js' %>" type='text/javascript'></script>
|
19
|
-
<script src="<%= asset_path 'swagger-ui/lib/handlebars-4.0.5.js' %>" type='text/javascript'></script>
|
20
|
-
<script src="<%= asset_path 'swagger-ui/lib/lodash.min.js' %>" type='text/javascript'></script>
|
21
|
-
<script src="<%= asset_path 'swagger-ui/lib/backbone-min.js' %>" type='text/javascript'></script>
|
22
|
-
<script src="<%= asset_path 'swagger-ui/swagger-ui.min.js' %>" type='text/javascript'></script>
|
23
|
-
<script src="<%= asset_path 'swagger-ui/lib/highlight.9.1.0.pack.js' %>" type='text/javascript'></script>
|
24
|
-
<script src="<%= asset_path 'swagger-ui/lib/highlight.9.1.0.pack_extended.js' %>" type='text/javascript'></script>
|
25
|
-
<script src="<%= asset_path 'swagger-ui/lib/jsoneditor.min.js' %>" type='text/javascript'></script>
|
26
|
-
<script src="<%= asset_path 'swagger-ui/lib/marked.js' %>" type='text/javascript'></script>
|
27
|
-
<script src="<%= asset_path 'swagger-ui/lib/swagger-oauth.js' %>" type='text/javascript'></script>
|
28
|
-
|
29
|
-
<!-- Some basic translations -->
|
30
|
-
<!-- <script src="<%= asset_path 'swagger-ui/lang/translator.js' %>" type='text/javascript'></script> -->
|
31
|
-
<!-- <script src="<%= asset_path 'swagger-ui/lang/ru.js' %>" type='text/javascript'></script> -->
|
32
|
-
<!-- <script src="<%= asset_path 'swagger-ui/lang/en.js' %>" type='text/javascript'></script> -->
|
33
|
-
|
34
|
-
<script type="text/javascript">
|
35
|
-
$(function () {
|
36
|
-
hljs.configure({
|
37
|
-
highlightSizeThreshold: 5000
|
38
|
-
});
|
39
|
-
|
40
|
-
// Pre load translate...
|
41
|
-
if(window.SwaggerTranslator) {
|
42
|
-
window.SwaggerTranslator.translate();
|
43
|
-
}
|
44
|
-
window.swaggerUi = new SwaggerUi({
|
45
|
-
url: '<%= @swagger_endpoints.first.path %>',
|
46
|
-
dom_id: "swagger-ui-container",
|
47
|
-
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
|
48
|
-
onComplete: function(swaggerApi, swaggerUi){
|
49
|
-
if(typeof initOAuth == "function") {
|
50
|
-
initOAuth({
|
51
|
-
clientId: "your-client-id",
|
52
|
-
clientSecret: "your-client-secret-if-required",
|
53
|
-
realm: "your-realms",
|
54
|
-
appName: "your-app-name",
|
55
|
-
scopeSeparator: " ",
|
56
|
-
additionalQueryStringParams: {}
|
57
|
-
});
|
58
|
-
}
|
59
|
-
|
60
|
-
if(window.SwaggerTranslator) {
|
61
|
-
window.SwaggerTranslator.translate();
|
62
|
-
}
|
63
|
-
},
|
64
|
-
onFailure: function(data) {
|
65
|
-
log("Unable to Load SwaggerUI");
|
66
|
-
},
|
67
|
-
docExpansion: "list",
|
68
|
-
jsonEditor: false,
|
69
|
-
defaultModelRendering: 'schema',
|
70
|
-
showRequestHeaders: false
|
71
|
-
});
|
72
|
-
|
73
|
-
window.swaggerUi.load();
|
74
|
-
|
75
|
-
function log() {
|
76
|
-
if ('console' in window) {
|
77
|
-
console.log.apply(console, arguments);
|
78
|
-
}
|
79
|
-
}
|
80
|
-
});
|
81
|
-
</script>
|
82
|
-
</head>
|
83
|
-
|
84
|
-
<body class="swagger-section">
|
85
|
-
<div id='header'>
|
86
|
-
<div class="swagger-ui-wrap">
|
87
|
-
<a id="logo" href="http://swagger.io"><img class="logo__img" alt="swagger" height="30" width="30" src="<%= asset_path 'swagger-ui/images/logo_small.png' %>" /><span class="logo__title">swagger</span></a>
|
88
|
-
<form id='api_selector'>
|
89
|
-
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
|
90
|
-
<div id='auth_container'></div>
|
91
|
-
<select id="select_document">
|
92
|
-
<% @swagger_endpoints.each do |endpoint| %>
|
93
|
-
<option value='<%= endpoint.path %>'><%= endpoint.title %></option>
|
94
|
-
<% end %>
|
95
|
-
</select>
|
96
|
-
<script type="text/javascript">
|
97
|
-
// Refresh the swagger-ui when a new document is selected
|
98
|
-
$('#select_document').change(function () {
|
99
|
-
$('#input_baseUrl').val($(this).val());
|
100
|
-
window.swaggerUi.headerView.showCustom();
|
101
|
-
});
|
102
|
-
</script>
|
103
|
-
<style>
|
104
|
-
#select_document {
|
105
|
-
border: none;
|
106
|
-
height: 1.85em;
|
107
|
-
border-radius: 4px;
|
108
|
-
-moz-border-radius: 4px;
|
109
|
-
-webkit-border-radius: 4px;
|
110
|
-
-o-border-radius: 4px;
|
111
|
-
-ms-border-radius: 4px;
|
112
|
-
-khtml-border-radius: 4px;
|
113
|
-
font-size: 0.85em;
|
114
|
-
font-weight: bold;
|
115
|
-
color: white;
|
116
|
-
background-color: #547f00;
|
117
|
-
}
|
118
|
-
</style>
|
119
|
-
</form>
|
120
|
-
</div>
|
121
|
-
</div>
|
122
|
-
|
123
|
-
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div>
|
124
|
-
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
|
125
|
-
</body>
|
126
|
-
</html>
|