grape-swagger-ui 0.0.9 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +39 -0
- data/README.md +11 -15
- data/app/views/layouts/swagger.html.erb +75 -61
- data/lib/generators/swagger/layout/templates/swagger.html.haml +67 -20
- data/lib/grape-swagger-ui/version.rb +1 -1
- data/vendor/assets/fonts/DroidSans-Bold.ttf +0 -0
- data/vendor/assets/fonts/DroidSans.ttf +0 -0
- data/vendor/assets/images/collapse.gif +0 -0
- data/vendor/assets/images/expand.gif +0 -0
- data/vendor/assets/images/favicon-16x16.png +0 -0
- data/vendor/assets/images/favicon-32x32.png +0 -0
- data/vendor/assets/images/favicon.ico +0 -0
- data/vendor/assets/javascripts/lang/en.js +56 -0
- data/vendor/assets/javascripts/lang/es.js +53 -0
- data/vendor/assets/javascripts/lang/fr.js +54 -0
- data/vendor/assets/javascripts/lang/geo.js +56 -0
- data/vendor/assets/javascripts/lang/it.js +52 -0
- data/vendor/assets/javascripts/lang/ja.js +53 -0
- data/vendor/assets/javascripts/lang/pl.js +53 -0
- data/vendor/assets/javascripts/lang/pt.js +53 -0
- data/vendor/assets/javascripts/lang/ru.js +56 -0
- data/vendor/assets/javascripts/lang/tr.js +53 -0
- data/vendor/assets/javascripts/lang/translator.js +39 -0
- data/vendor/assets/javascripts/lang/zh-cn.js +53 -0
- data/vendor/assets/javascripts/lib/backbone-min.js +14 -37
- data/vendor/assets/javascripts/lib/handlebars-2.0.0.js +28 -0
- data/vendor/assets/javascripts/lib/highlight.9.1.0.pack.js +2 -0
- data/vendor/assets/javascripts/lib/highlight.9.1.0.pack_extended.js +34 -0
- data/vendor/assets/javascripts/lib/jquery-1.8.0.min.js +1 -1
- data/vendor/assets/javascripts/lib/js-yaml.min.js +3 -0
- data/vendor/assets/javascripts/lib/jsoneditor.min.js +11 -0
- data/vendor/assets/javascripts/lib/lodash.min.js +102 -0
- data/vendor/assets/javascripts/lib/marked.js +1272 -0
- data/vendor/assets/javascripts/lib/object-assign-pollyfill.js +23 -0
- data/vendor/assets/javascripts/lib/swagger-oauth.js +193 -65
- data/vendor/assets/javascripts/swagger-ui.js +22064 -2110
- data/vendor/assets/javascripts/swagger-ui.min.js +9 -0
- data/vendor/assets/javascripts/swagger_ui.js +11 -8
- data/vendor/assets/stylesheets/print.css +1362 -0
- data/vendor/assets/stylesheets/reset_2.css +125 -0
- data/vendor/assets/stylesheets/screen.css +310 -45
- data/vendor/assets/stylesheets/style.css +250 -0
- data/vendor/assets/stylesheets/swagger_ui.css +7 -2
- data/vendor/assets/stylesheets/swagger_ui_print.css +15 -0
- data/vendor/assets/stylesheets/swagger_ui_screen.css +16 -0
- data/vendor/assets/stylesheets/typography.css +14 -0
- metadata +37 -8
- data/vendor/assets/javascripts/lib/handlebars-1.0.0.js +0 -2278
- data/vendor/assets/javascripts/lib/highlight.7.3.pack.js +0 -1
- data/vendor/assets/javascripts/lib/shred.bundle.js +0 -2765
- data/vendor/assets/javascripts/lib/shred/content.js +0 -193
- data/vendor/assets/javascripts/lib/swagger.js +0 -1653
- data/vendor/assets/javascripts/lib/underscore-min.js +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7e74c225b173b884858eff45aa6dda7b451d9bf
|
4
|
+
data.tar.gz: 40ce002bcd5c185be1fc5ca2bbc11bea0101fe9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80a484beff310bd15f208ee157238b7f8a4f08e99fb7b44ee4627e10281a87d3786703a35772a943c9da6f89259235c3c1e14356ce337417e8cec9fe4ae941c0
|
7
|
+
data.tar.gz: 7d49aacaf6fe37e28da760666ed11543a85bf75e461502e6814aff13f0c34f7b3c5aa68935e8503b82ac6ff72f8bb10b4d7ed3dc9f83dc030a5b3eadbef7979c
|
data/.gitignore
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [Unreleased](https://github.com/kendrikat/grape-swagger-ui/tree/HEAD)
|
4
|
+
|
5
|
+
[Full Changelog](https://github.com/kendrikat/grape-swagger-ui/compare/v0.0.3...HEAD)
|
6
|
+
|
7
|
+
**Closed issues:**
|
8
|
+
|
9
|
+
- Swagger UI needs to be updated [\#9](https://github.com/kendrikat/grape-swagger-ui/issues/9)
|
10
|
+
|
11
|
+
## [v0.0.3](https://github.com/kendrikat/grape-swagger-ui/tree/v0.0.3) (2016-08-09)
|
12
|
+
[Full Changelog](https://github.com/kendrikat/grape-swagger-ui/compare/v0.0.2...v0.0.3)
|
13
|
+
|
14
|
+
**Closed issues:**
|
15
|
+
|
16
|
+
- Routing not working [\#6](https://github.com/kendrikat/grape-swagger-ui/issues/6)
|
17
|
+
- haml issue in rails 4 [\#4](https://github.com/kendrikat/grape-swagger-ui/issues/4)
|
18
|
+
|
19
|
+
**Merged pull requests:**
|
20
|
+
|
21
|
+
- Support swagger spec 2.0 [\#8](https://github.com/kendrikat/grape-swagger-ui/pull/8) ([dangnm](https://github.com/dangnm))
|
22
|
+
|
23
|
+
## [v0.0.2](https://github.com/kendrikat/grape-swagger-ui/tree/v0.0.2) (2015-01-14)
|
24
|
+
[Full Changelog](https://github.com/kendrikat/grape-swagger-ui/compare/v0.0.1...v0.0.2)
|
25
|
+
|
26
|
+
**Closed issues:**
|
27
|
+
|
28
|
+
- License missing from gemspec [\#2](https://github.com/kendrikat/grape-swagger-ui/issues/2)
|
29
|
+
|
30
|
+
**Merged pull requests:**
|
31
|
+
|
32
|
+
- update for swagger-ui 2.0.24 [\#5](https://github.com/kendrikat/grape-swagger-ui/pull/5) ([alexagranov](https://github.com/alexagranov))
|
33
|
+
- assets path mistake in swagger-ui.js [\#3](https://github.com/kendrikat/grape-swagger-ui/pull/3) ([dfang](https://github.com/dfang))
|
34
|
+
- Optional form fields are not being send with request [\#1](https://github.com/kendrikat/grape-swagger-ui/pull/1) ([camol](https://github.com/camol))
|
35
|
+
|
36
|
+
## [v0.0.1](https://github.com/kendrikat/grape-swagger-ui/tree/v0.0.1) (2013-02-25)
|
37
|
+
|
38
|
+
|
39
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/README.md
CHANGED
@@ -5,12 +5,7 @@ Grape::Swagger::Ui
|
|
5
5
|
|
6
6
|
TODO/WIP: Write a gem description
|
7
7
|
|
8
|
-
Integrates [swagger-ui] with your "grapified"
|
9
|
-
|
10
|
-
** UPDATE FOR 0.0.9 **
|
11
|
-
-
|
12
|
-
|
13
|
-
- The property for specifying your Swagger endpoint on SwaggerUi has been renamed from 'discoveryUrl' to just 'url'. This has been updated in the index page template 'swagger.html.erb' but you will need to either regenerate or manually edit your existing page.
|
8
|
+
Integrates [swagger-ui] with your "grapified" Rails application.
|
14
9
|
|
15
10
|
## Dependencies
|
16
11
|
|
@@ -36,11 +31,15 @@ Or install it yourself as:
|
|
36
31
|
|
37
32
|
## Usage example:
|
38
33
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
34
|
+
class YourAPI < Grape::API
|
35
|
+
version 'v1'
|
36
|
+
format :json
|
37
|
+
...
|
38
|
+
add_swagger_documentation :add_version => true,
|
39
|
+
:base_path => '/api'
|
40
|
+
end
|
41
|
+
|
42
|
+
*See https://github.com/ruby-grape/grape-swagger#configure for more configuration settings.*
|
44
43
|
|
45
44
|
If your api path is "api/v1" just go to
|
46
45
|
|
@@ -57,11 +56,8 @@ and change the initializer.
|
|
57
56
|
Since this is a seperate layout and if you want to use this in your staging environment you need to precompile it.
|
58
57
|
|
59
58
|
#staging.rb
|
60
|
-
config.assets.precompile +=
|
61
|
-
|
62
|
-
## Version
|
59
|
+
config.assets.precompile += %w(swagger_ui.js swagger_ui.css swagger_ui_print.css swagger_ui_screen.css)
|
63
60
|
|
64
|
-
0.0.9
|
65
61
|
|
66
62
|
## Contributing
|
67
63
|
|
@@ -4,79 +4,93 @@
|
|
4
4
|
<title>Swagger UI</title>
|
5
5
|
<%= javascript_include_tag :swagger_ui %>
|
6
6
|
<%= stylesheet_link_tag "//fonts.googleapis.com/css?family=Droid+Sans:400,700" %>
|
7
|
-
<%= stylesheet_link_tag :
|
7
|
+
<%= stylesheet_link_tag :swagger_ui_screen, :media => :screen %>
|
8
|
+
<%= stylesheet_link_tag :swagger_ui_print, :media => :print %>
|
8
9
|
<%= csrf_meta_tags %>
|
9
10
|
|
10
|
-
<script>
|
11
|
+
<script type="text/javascript">
|
12
|
+
$(function () {
|
13
|
+
var url = window.location.search.match(/url=([^&]+)/);
|
14
|
+
if (url && url.length > 1) {
|
15
|
+
url = decodeURIComponent(url[1]);
|
16
|
+
} else {
|
17
|
+
url = "http://<%= request.host%>:<%=request.port%>/api/v1/swagger_doc";
|
18
|
+
}
|
11
19
|
|
12
|
-
|
13
|
-
|
14
|
-
options.headers = {'X-CSRF-Token': '#{form_authenticity_token.to_s}'}
|
15
|
-
});
|
20
|
+
hljs.configure({
|
21
|
+
highlightSizeThreshold: 5000
|
16
22
|
});
|
17
23
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
hljs.highlightBlock(e)
|
38
|
-
});
|
39
|
-
},
|
40
|
-
onFailure: function (data) {
|
41
|
-
log("Unable to Load SwaggerUI");
|
42
|
-
},
|
43
|
-
docExpansion: "none",
|
44
|
-
sorter: "alpha"
|
45
|
-
});
|
24
|
+
// Pre load translate...
|
25
|
+
if(window.SwaggerTranslator) {
|
26
|
+
window.SwaggerTranslator.translate();
|
27
|
+
}
|
28
|
+
window.swaggerUi = new SwaggerUi({
|
29
|
+
url: url,
|
30
|
+
dom_id: "swagger-ui-container",
|
31
|
+
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
|
32
|
+
onComplete: function(swaggerApi, swaggerUi){
|
33
|
+
if(typeof initOAuth == "function") {
|
34
|
+
initOAuth({
|
35
|
+
clientId: "your-client-id",
|
36
|
+
clientSecret: "your-client-secret-if-required",
|
37
|
+
realm: "your-realms",
|
38
|
+
appName: "your-app-name",
|
39
|
+
scopeSeparator: ",",
|
40
|
+
additionalQueryStringParams: {}
|
41
|
+
});
|
42
|
+
}
|
46
43
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
44
|
+
if(window.SwaggerTranslator) {
|
45
|
+
window.SwaggerTranslator.translate();
|
46
|
+
}
|
47
|
+
},
|
48
|
+
onFailure: function(data) {
|
49
|
+
log("Unable to Load SwaggerUI");
|
50
|
+
},
|
51
|
+
docExpansion: "none",
|
52
|
+
jsonEditor: false,
|
53
|
+
defaultModelRendering: 'schema',
|
54
|
+
showRequestHeaders: false
|
56
55
|
});
|
57
56
|
|
57
|
+
$('#input_apiKey').change(function() {
|
58
|
+
var key = $('#input_apiKey')[0].value;
|
59
|
+
if(key && key.trim() != "") {
|
60
|
+
swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("api_key", key, "query"));
|
61
|
+
}
|
62
|
+
})
|
58
63
|
|
64
|
+
window.swaggerUi.load();
|
65
|
+
|
66
|
+
function log() {
|
67
|
+
if ('console' in window) {
|
68
|
+
console.log.apply(console, arguments);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
});
|
59
72
|
</script>
|
73
|
+
|
60
74
|
</head>
|
61
|
-
<body class="swagger-section">
|
62
|
-
<div id="header">
|
63
|
-
<div class="swagger-ui-wrap">
|
64
|
-
<a href="http://swagger.wordnik.com" id="logo">Swagger</a>
|
65
75
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
|
77
|
+
<body class="swagger-section">
|
78
|
+
<div id='header'>
|
79
|
+
<div class="swagger-ui-wrap">
|
80
|
+
<a id="logo" href="http://swagger.io"><span class="logo__title">swagger</span></a>
|
81
|
+
<form id='api_selector'>
|
82
|
+
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
|
83
|
+
<div class="input">
|
84
|
+
<input id="input_apiKey" name="apiKey" placeholder="api_key" type="text"></input>
|
85
|
+
</div>
|
86
|
+
<div id='auth_container'></div>
|
87
|
+
<div class='input'><a id="explore" class="header__btn" href="#" data-sw-translate>Explore</a></div>
|
88
|
+
</form>
|
89
|
+
</div>
|
78
90
|
</div>
|
79
|
-
|
80
|
-
<div class="swagger-ui-wrap"
|
91
|
+
|
92
|
+
<div id="message-bar" class="swagger-ui-wrap" data-sw-translate> </div>
|
93
|
+
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
|
81
94
|
</body>
|
95
|
+
|
82
96
|
</html>
|
@@ -4,7 +4,8 @@
|
|
4
4
|
%title Swagger UI
|
5
5
|
|
6
6
|
= javascript_include_tag :swagger_ui
|
7
|
-
= stylesheet_link_tag :
|
7
|
+
= stylesheet_link_tag :swagger_ui_screen, :media => :screen
|
8
|
+
= stylesheet_link_tag :swagger_ui_print, :media => :print
|
8
9
|
= csrf_meta_tags
|
9
10
|
|
10
11
|
:css
|
@@ -14,36 +15,82 @@
|
|
14
15
|
margin-left: auto;
|
15
16
|
margin-right: auto;
|
16
17
|
}
|
17
|
-
|
18
|
-
:javascript
|
19
|
-
$(function(){
|
20
|
-
$.ajaxPrefilter(function(o, options){
|
21
|
-
options.headers = { 'X-CSRF-Token': '#{form_authenticity_token.to_s}' }
|
22
|
-
});
|
23
|
-
});
|
24
18
|
|
19
|
+
:javascript
|
25
20
|
$(function () {
|
21
|
+
var url = window.location.search.match(/url=([^&]+)/);
|
22
|
+
if (url && url.length > 1) {
|
23
|
+
url = decodeURIComponent(url[1]);
|
24
|
+
} else {
|
25
|
+
url = "http://#{request.host}:#{request.port}/api/v1/swagger_doc";
|
26
|
+
}
|
27
|
+
|
28
|
+
hljs.configure({
|
29
|
+
highlightSizeThreshold: 5000
|
30
|
+
});
|
31
|
+
|
32
|
+
// Pre load translate...
|
33
|
+
if(window.SwaggerTranslator) {
|
34
|
+
window.SwaggerTranslator.translate();
|
35
|
+
}
|
26
36
|
window.swaggerUi = new SwaggerUi({
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
37
|
+
url: url,
|
38
|
+
dom_id: "swagger-ui-container",
|
39
|
+
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'],
|
40
|
+
onComplete: function(swaggerApi, swaggerUi){
|
41
|
+
if(typeof initOAuth == "function") {
|
42
|
+
initOAuth({
|
43
|
+
clientId: "your-client-id",
|
44
|
+
clientSecret: "your-client-secret-if-required",
|
45
|
+
realm: "your-realms",
|
46
|
+
appName: "your-app-name",
|
47
|
+
scopeSeparator: ",",
|
48
|
+
additionalQueryStringParams: {}
|
49
|
+
});
|
50
|
+
}
|
51
|
+
|
52
|
+
if(window.SwaggerTranslator) {
|
53
|
+
window.SwaggerTranslator.translate();
|
54
|
+
}
|
55
|
+
},
|
56
|
+
onFailure: function(data) {
|
57
|
+
log("Unable to Load SwaggerUI");
|
58
|
+
},
|
59
|
+
docExpansion: "none",
|
60
|
+
jsonEditor: false,
|
61
|
+
defaultModelRendering: 'schema',
|
62
|
+
showRequestHeaders: false
|
32
63
|
});
|
64
|
+
|
65
|
+
$('#input_apiKey').change(function() {
|
66
|
+
var key = $('#input_apiKey')[0].value;
|
67
|
+
if(key && key.trim() != "") {
|
68
|
+
swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("api_key", key, "query"));
|
69
|
+
}
|
70
|
+
})
|
71
|
+
|
33
72
|
window.swaggerUi.load();
|
73
|
+
|
74
|
+
function log() {
|
75
|
+
if ('console' in window) {
|
76
|
+
console.log.apply(console, arguments);
|
77
|
+
}
|
78
|
+
}
|
34
79
|
});
|
35
80
|
|
36
|
-
%body
|
81
|
+
%body.swagger-section
|
37
82
|
#header
|
38
83
|
.swagger-ui-wrap
|
39
|
-
%a#logo{
|
84
|
+
%a#logo{:href => "http://swagger.io"}
|
85
|
+
%span.logo__title swagger
|
40
86
|
%form#api_selector
|
41
87
|
.input
|
42
|
-
%input#input_baseUrl{ placeholder
|
88
|
+
%input#input_baseUrl{:name => "baseUrl", :placeholder => "http://example.com/api", :type => "text"}/
|
43
89
|
.input
|
44
|
-
%input#input_apiKey{
|
90
|
+
%input#input_apiKey{:name => "apiKey", :placeholder => "api_key", :type => "text"}
|
91
|
+
#auth_container
|
45
92
|
.input
|
46
|
-
%a#explore{ href
|
93
|
+
%a#explore.header__btn{"data-sw-translate" => "", :href => "#"} Explore
|
94
|
+
#message-bar.swagger-ui-wrap{"data-sw-translate" => ""}
|
95
|
+
#swagger-ui-container.swagger-ui-wrap
|
47
96
|
|
48
|
-
#message-bar.swagger-ui-wrap
|
49
|
-
#swagger-ui-container.swagger-ui-wrap
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -0,0 +1,56 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
/* jshint quotmark: double */
|
4
|
+
window.SwaggerTranslator.learn({
|
5
|
+
"Warning: Deprecated":"Warning: Deprecated",
|
6
|
+
"Implementation Notes":"Implementation Notes",
|
7
|
+
"Response Class":"Response Class",
|
8
|
+
"Status":"Status",
|
9
|
+
"Parameters":"Parameters",
|
10
|
+
"Parameter":"Parameter",
|
11
|
+
"Value":"Value",
|
12
|
+
"Description":"Description",
|
13
|
+
"Parameter Type":"Parameter Type",
|
14
|
+
"Data Type":"Data Type",
|
15
|
+
"Response Messages":"Response Messages",
|
16
|
+
"HTTP Status Code":"HTTP Status Code",
|
17
|
+
"Reason":"Reason",
|
18
|
+
"Response Model":"Response Model",
|
19
|
+
"Request URL":"Request URL",
|
20
|
+
"Response Body":"Response Body",
|
21
|
+
"Response Code":"Response Code",
|
22
|
+
"Response Headers":"Response Headers",
|
23
|
+
"Hide Response":"Hide Response",
|
24
|
+
"Headers":"Headers",
|
25
|
+
"Try it out!":"Try it out!",
|
26
|
+
"Show/Hide":"Show/Hide",
|
27
|
+
"List Operations":"List Operations",
|
28
|
+
"Expand Operations":"Expand Operations",
|
29
|
+
"Raw":"Raw",
|
30
|
+
"can't parse JSON. Raw result":"can't parse JSON. Raw result",
|
31
|
+
"Example Value":"Example Value",
|
32
|
+
"Model Schema":"Model Schema",
|
33
|
+
"Model":"Model",
|
34
|
+
"Click to set as parameter value":"Click to set as parameter value",
|
35
|
+
"apply":"apply",
|
36
|
+
"Username":"Username",
|
37
|
+
"Password":"Password",
|
38
|
+
"Terms of service":"Terms of service",
|
39
|
+
"Created by":"Created by",
|
40
|
+
"See more at":"See more at",
|
41
|
+
"Contact the developer":"Contact the developer",
|
42
|
+
"api version":"api version",
|
43
|
+
"Response Content Type":"Response Content Type",
|
44
|
+
"Parameter content type:":"Parameter content type:",
|
45
|
+
"fetching resource":"fetching resource",
|
46
|
+
"fetching resource list":"fetching resource list",
|
47
|
+
"Explore":"Explore",
|
48
|
+
"Show Swagger Petstore Example Apis":"Show Swagger Petstore Example Apis",
|
49
|
+
"Can't read from server. It may not have the appropriate access-control-origin settings.":"Can't read from server. It may not have the appropriate access-control-origin settings.",
|
50
|
+
"Please specify the protocol for":"Please specify the protocol for",
|
51
|
+
"Can't read swagger JSON from":"Can't read swagger JSON from",
|
52
|
+
"Finished Loading Resource Information. Rendering Swagger UI":"Finished Loading Resource Information. Rendering Swagger UI",
|
53
|
+
"Unable to read api":"Unable to read api",
|
54
|
+
"from path":"from path",
|
55
|
+
"server returned":"server returned"
|
56
|
+
});
|