Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8d0c9107e7 | ||
|
|
1f3746a846 | ||
|
|
9cedc0b4d7 | ||
|
|
ca47551d93 | ||
|
|
15afbcf14f | ||
|
|
34ab47e9e7 | ||
|
|
84f4e670fc | ||
|
|
f6380d17e5 | ||
|
|
a536583890 | ||
|
|
a36da91d7e | ||
|
|
96c14e43a9 | ||
|
|
2edd7ac058 | ||
|
|
da63a33845 | ||
|
|
579abd6848 | ||
|
|
1f6aa46e52 | ||
|
|
c9652472a2 | ||
|
|
aeffecd8d4 | ||
|
|
9e8e62c17c | ||
|
|
c69c6f8d34 | ||
|
|
fac6d94886 | ||
|
|
a5556d7f01 | ||
|
|
8f665f76da | ||
|
|
191416e666 | ||
|
|
e84acba53e | ||
|
|
1a346fbf26 | ||
|
|
28ac6f8745 | ||
|
|
77aa535a0f | ||
|
|
2a9453531d | ||
|
|
467cac23cc | ||
|
|
d6738ede2b | ||
|
|
5dffa48ac7 | ||
|
|
2393feacae | ||
|
|
a539691568 | ||
|
|
5418738956 | ||
|
|
c92e9a14b9 | ||
|
|
dc7b663239 | ||
|
|
7b77ffd079 | ||
|
|
2a642f5a5f | ||
|
|
99b3f7d00e | ||
|
|
aa848529c0 |
@@ -65,22 +65,28 @@ task 'dist', 'Build a distribution', ->
|
||||
throw err if err
|
||||
fs.unlink 'dist/_swagger-ui.coffee'
|
||||
console.log ' : Combining with javascript...'
|
||||
exec 'cat src/main/javascript/doc.js dist/_swagger-ui-templates.js dist/_swagger-ui.js > dist/swagger-ui.js', (err, stdout, stderr) ->
|
||||
throw err if err
|
||||
fs.unlink 'dist/_swagger-ui.js'
|
||||
fs.unlink 'dist/_swagger-ui-templates.js'
|
||||
console.log ' : Minifying all...'
|
||||
exec 'java -jar "./bin/yuicompressor-2.4.7.jar" --type js -o ' + 'dist/swagger-ui.min.js ' + 'dist/swagger-ui.js', (err, stdout, stderr) ->
|
||||
|
||||
fs.readFile 'package.json', 'utf8', (err, fileContents) ->
|
||||
obj = JSON.parse(fileContents)
|
||||
exec 'echo "// swagger-ui.js" > dist/swagger-ui.js'
|
||||
exec 'echo "// version ' + obj.version + '" >> dist/swagger-ui.js'
|
||||
exec 'cat src/main/javascript/doc.js dist/_swagger-ui-templates.js dist/_swagger-ui.js >> dist/swagger-ui.js', (err, stdout, stderr) ->
|
||||
throw err if err
|
||||
lessc()
|
||||
fs.unlink 'dist/_swagger-ui.js'
|
||||
fs.unlink 'dist/_swagger-ui-templates.js'
|
||||
console.log ' : Minifying all...'
|
||||
exec 'java -jar "./bin/yuicompressor-2.4.7.jar" --type js -o ' + 'dist/swagger-ui.min.js ' + 'dist/swagger-ui.js', (err, stdout, stderr) ->
|
||||
throw err if err
|
||||
lessc()
|
||||
|
||||
lessc = ->
|
||||
# Someone who knows CoffeeScript should make this more Coffee-licious
|
||||
console.log ' : Compiling LESS...'
|
||||
|
||||
less.render fs.readFileSync("src/main/less/screen.less", 'utf8'), (err, css) ->
|
||||
console.log err
|
||||
fs.writeFileSync("src/main/html/css/screen.css", css)
|
||||
less.render fs.readFileSync("src/main/less/reset.less", 'utf8'), (err, css) ->
|
||||
fs.writeFileSync("src/main/html/css/reset.css", css)
|
||||
pack()
|
||||
|
||||
pack = ->
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
Copyright 2014 Reverb Technologies, Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,13 +1,20 @@
|
||||
Swagger UI
|
||||
==========
|
||||
# Swagger UI
|
||||
|
||||
Swagger UI is part of [Swagger](http://swagger.wordnik.com/) project. The Swagger project allows you to produce, visualize and consume your OWN RESTful services. No proxy or 3rd party services required. Do it your own way.
|
||||
|
||||
Swagger UI is part of Swagger project. The Swagger project allows you to produce, visualize and consume your OWN RESTful services. No proxy or 3rd party services required. Do it your own way.
|
||||
|
||||
Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically
|
||||
generate beautiful documentation and sandbox from a [Swagger-compliant](https://github.com/wordnik/swagger-core/wiki) API. Because Swagger UI has no dependencies, you can host it in any server environment, or on your local machine.
|
||||
generate beautiful documentation and sandbox from a Swagger-compliant API. Because Swagger UI has no dependencies, you can host it in any server environment, or on your local machine.
|
||||
|
||||
How to Use It
|
||||
-------------
|
||||
## What's Swagger?
|
||||
|
||||
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swager removes the guesswork in calling the service.
|
||||
|
||||
|
||||
Check out [Swagger-Spec](https://github.com/wordnik/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more.
|
||||
|
||||
|
||||
## How to Use It
|
||||
|
||||
### Download
|
||||
You can use the swagger-ui code AS-IS! No need to build or recompile--just clone this repo and use the pre-built files in the `dist` folder. If you like swagger-ui as-is, stop here.
|
||||
@@ -85,8 +92,7 @@ window.authorizations.add("key", new ApiKeyAuthorization("Authorization", "XXXX"
|
||||
|
||||
Note! You can pass multiple header params on a single request, just use unique names for them (`key` is used in the above example).
|
||||
|
||||
How to Improve It
|
||||
-----------------
|
||||
## How to Improve It
|
||||
|
||||
Create your own fork of [wordnik/swagger-ui](https://github.com/wordnik/swagger-ui)
|
||||
|
||||
@@ -94,8 +100,7 @@ To share your changes, [submit a pull request](https://github.com/wordnik/swagge
|
||||
|
||||
Since the javascript files are compiled from coffeescript, please submit changes in the *.coffee files! We have to reject changes only in the .js files as they will be lost on each build of the ui.
|
||||
|
||||
License
|
||||
-------
|
||||
## License
|
||||
|
||||
Copyright 2011-2013 Wordnik, Inc.
|
||||
|
||||
|
||||
Vendored
+125
@@ -0,0 +1,125 @@
|
||||
/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */
|
||||
html,
|
||||
body,
|
||||
div,
|
||||
span,
|
||||
applet,
|
||||
object,
|
||||
iframe,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
a,
|
||||
abbr,
|
||||
acronym,
|
||||
address,
|
||||
big,
|
||||
cite,
|
||||
code,
|
||||
del,
|
||||
dfn,
|
||||
em,
|
||||
img,
|
||||
ins,
|
||||
kbd,
|
||||
q,
|
||||
s,
|
||||
samp,
|
||||
small,
|
||||
strike,
|
||||
strong,
|
||||
sub,
|
||||
sup,
|
||||
tt,
|
||||
var,
|
||||
b,
|
||||
u,
|
||||
i,
|
||||
center,
|
||||
dl,
|
||||
dt,
|
||||
dd,
|
||||
ol,
|
||||
ul,
|
||||
li,
|
||||
fieldset,
|
||||
form,
|
||||
label,
|
||||
legend,
|
||||
table,
|
||||
caption,
|
||||
tbody,
|
||||
tfoot,
|
||||
thead,
|
||||
tr,
|
||||
th,
|
||||
td,
|
||||
article,
|
||||
aside,
|
||||
canvas,
|
||||
details,
|
||||
embed,
|
||||
figure,
|
||||
figcaption,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
menu,
|
||||
nav,
|
||||
output,
|
||||
ruby,
|
||||
section,
|
||||
summary,
|
||||
time,
|
||||
mark,
|
||||
audio,
|
||||
video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
menu,
|
||||
nav,
|
||||
section {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
ol,
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote,
|
||||
q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before,
|
||||
blockquote:after,
|
||||
q:before,
|
||||
q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
Vendored
+538
-387
File diff suppressed because it is too large
Load Diff
Vendored
BIN
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
Vendored
+22
-15
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<title>Swagger UI</title>
|
||||
<link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/highlight.default.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||
<script type="text/javascript" src="lib/shred.bundle.js"></script>
|
||||
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
|
||||
@@ -16,6 +16,10 @@
|
||||
<script src='lib/swagger.js' type='text/javascript'></script>
|
||||
<script src='swagger-ui.js' type='text/javascript'></script>
|
||||
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
|
||||
|
||||
<!-- enabling this will enable oauth2 implicit scope support -->
|
||||
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
window.swaggerUi = new SwaggerUi({
|
||||
@@ -23,8 +27,20 @@
|
||||
dom_id: "swagger-ui-container",
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||
onComplete: function(swaggerApi, swaggerUi){
|
||||
log("Loaded SwaggerUI")
|
||||
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
||||
log("Loaded SwaggerUI");
|
||||
|
||||
if(typeof initOAuth == "function") {
|
||||
/*
|
||||
initOAuth({
|
||||
clientId: "your-client-id",
|
||||
realm: "your-realms",
|
||||
appName: "your-app-name"
|
||||
});
|
||||
*/
|
||||
}
|
||||
$('pre code').each(function(i, e) {
|
||||
hljs.highlightBlock(e)
|
||||
});
|
||||
},
|
||||
onFailure: function(data) {
|
||||
log("Unable to Load SwaggerUI");
|
||||
@@ -42,15 +58,13 @@
|
||||
})
|
||||
window.swaggerUi.load();
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="swagger-section">
|
||||
<div id='header'>
|
||||
<div class="swagger-ui-wrap">
|
||||
<a id="logo" href="http://swagger.wordnik.com">swagger</a>
|
||||
|
||||
<form id='api_selector'>
|
||||
<div class='input icon-btn'>
|
||||
<img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example Apis">
|
||||
@@ -65,14 +79,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="message-bar" class="swagger-ui-wrap">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="swagger-ui-container" class="swagger-ui-wrap">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="message-bar" class="swagger-ui-wrap"> </div>
|
||||
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Vendored
+211
@@ -0,0 +1,211 @@
|
||||
var appName;
|
||||
var popupMask;
|
||||
var popupDialog;
|
||||
var clientId;
|
||||
var realm;
|
||||
|
||||
function handleLogin() {
|
||||
var scopes = [];
|
||||
|
||||
if(window.swaggerUi.api.authSchemes
|
||||
&& window.swaggerUi.api.authSchemes.oauth2
|
||||
&& window.swaggerUi.api.authSchemes.oauth2.scopes) {
|
||||
scopes = window.swaggerUi.api.authSchemes.oauth2.scopes;
|
||||
}
|
||||
|
||||
if(window.swaggerUi.api
|
||||
&& window.swaggerUi.api.info) {
|
||||
appName = window.swaggerUi.api.info.title;
|
||||
}
|
||||
|
||||
if(popupDialog.length > 0)
|
||||
popupDialog = popupDialog.last();
|
||||
else {
|
||||
popupDialog = $(
|
||||
[
|
||||
'<div class="api-popup-dialog">',
|
||||
'<div class="api-popup-title">Select OAuth2.0 Scopes</div>',
|
||||
'<div class="api-popup-content">',
|
||||
'<p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.',
|
||||
'<a href="#">Learn how to use</a>',
|
||||
'</p>',
|
||||
'<p><strong>' + appName + '</strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>',
|
||||
'<ul class="api-popup-scopes">',
|
||||
'</ul>',
|
||||
'<p class="error-msg"></p>',
|
||||
'<div class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button">Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
|
||||
'</div>',
|
||||
'</div>'].join(''));
|
||||
$(document.body).append(popupDialog);
|
||||
|
||||
popup = popupDialog.find('ul.api-popup-scopes').empty();
|
||||
for (i = 0; i < scopes.length; i ++) {
|
||||
scope = scopes[i];
|
||||
str = '<li><input type="checkbox" id="scope_' + i + '" scope="' + scope.scope + '"/>' + '<label for="scope_' + i + '">' + scope.scope;
|
||||
if (scope.description) {
|
||||
str += '<br/><span class="api-scope-desc">' + scope.description + '</span>';
|
||||
}
|
||||
str += '</label></li>';
|
||||
popup.append(str);
|
||||
}
|
||||
}
|
||||
|
||||
var $win = $(window),
|
||||
dw = $win.width(),
|
||||
dh = $win.height(),
|
||||
st = $win.scrollTop(),
|
||||
dlgWd = popupDialog.outerWidth(),
|
||||
dlgHt = popupDialog.outerHeight(),
|
||||
top = (dh -dlgHt)/2 + st,
|
||||
left = (dw - dlgWd)/2;
|
||||
|
||||
popupDialog.css({
|
||||
top: (top < 0? 0 : top) + 'px',
|
||||
left: (left < 0? 0 : left) + 'px'
|
||||
});
|
||||
|
||||
popupDialog.find('button.api-popup-cancel').click(function() {
|
||||
popupMask.hide();
|
||||
popupDialog.hide();
|
||||
});
|
||||
popupDialog.find('button.api-popup-authbtn').click(function() {
|
||||
popupMask.hide();
|
||||
popupDialog.hide();
|
||||
|
||||
var authSchemes = window.swaggerUi.api.authSchemes;
|
||||
var host = window.location;
|
||||
var redirectUrl = host.protocol + '//' + host.host + "/o2c.html";
|
||||
var url = null;
|
||||
|
||||
var p = window.swaggerUi.api.authSchemes;
|
||||
for (var key in p) {
|
||||
if (p.hasOwnProperty(key)) {
|
||||
var o = p[key].grantTypes;
|
||||
for(var t in o) {
|
||||
if(o.hasOwnProperty(t) && t === 'implicit') {
|
||||
var dets = o[t];
|
||||
url = dets.loginEndpoint.url + "?response_type=token";
|
||||
window.swaggerUi.tokenName = dets.tokenName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var scopes = []
|
||||
var o = $('.api-popup-scopes').find('input:checked');
|
||||
|
||||
for(k =0; k < o.length; k++) {
|
||||
scopes.push($(o[k]).attr("scope"));
|
||||
}
|
||||
|
||||
window.enabledScopes=scopes;
|
||||
|
||||
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
|
||||
url += '&realm=' + encodeURIComponent(realm);
|
||||
url += '&client_id=' + encodeURIComponent(clientId);
|
||||
url += '&scope=' + encodeURIComponent(scopes);
|
||||
|
||||
window.open(url);
|
||||
});
|
||||
|
||||
popupMask.show();
|
||||
popupDialog.show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function handleLogout() {
|
||||
for(key in window.authorizations.authz){
|
||||
window.authorizations.remove(key)
|
||||
}
|
||||
window.enabledScopes = null;
|
||||
$('.api-ic.ic-on').addClass('ic-off');
|
||||
$('.api-ic.ic-on').removeClass('ic-on');
|
||||
|
||||
// set the info box
|
||||
$('.api-ic.ic-warning').addClass('ic-error');
|
||||
$('.api-ic.ic-warning').removeClass('ic-warning');
|
||||
}
|
||||
|
||||
function initOAuth(opts) {
|
||||
var o = (opts||{});
|
||||
var errors = [];
|
||||
|
||||
appName = (o.appName||errors.push("missing appName"));
|
||||
popupMask = (o.popupMask||$('#api-common-mask'));
|
||||
popupDialog = (o.popupDialog||$('.api-popup-dialog'));
|
||||
clientId = (o.clientId||errors.push("missing client id"));
|
||||
realm = (o.realm||errors.push("missing realm"));
|
||||
|
||||
if(errors.length > 0){
|
||||
log("auth unable initialize oauth: " + errors);
|
||||
return;
|
||||
}
|
||||
|
||||
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
||||
$('.api-ic').click(function(s) {
|
||||
if($(s.target).hasClass('ic-off'))
|
||||
handleLogin();
|
||||
else {
|
||||
handleLogout();
|
||||
}
|
||||
false;
|
||||
});
|
||||
}
|
||||
|
||||
function onOAuthComplete(token) {
|
||||
if(token) {
|
||||
if(token.error) {
|
||||
var checkbox = $('input[type=checkbox],.secured')
|
||||
checkbox.each(function(pos){
|
||||
checkbox[pos].checked = false;
|
||||
});
|
||||
alert(token.error);
|
||||
}
|
||||
else {
|
||||
var b = token[window.swaggerUi.tokenName];
|
||||
if(b){
|
||||
// if all roles are satisfied
|
||||
var o = null;
|
||||
$.each($('.auth #api_information_panel'), function(k, v) {
|
||||
var children = v;
|
||||
if(children && children.childNodes) {
|
||||
var requiredScopes = [];
|
||||
$.each((children.childNodes), function (k1, v1){
|
||||
var inner = v1.innerHTML;
|
||||
if(inner)
|
||||
requiredScopes.push(inner);
|
||||
});
|
||||
var diff = [];
|
||||
for(var i=0; i < requiredScopes.length; i++) {
|
||||
var s = requiredScopes[i];
|
||||
if(window.enabledScopes && window.enabledScopes.indexOf(s) == -1) {
|
||||
diff.push(s);
|
||||
}
|
||||
}
|
||||
if(diff.length > 0){
|
||||
o = v.parentNode;
|
||||
$(o.parentNode).find('.api-ic.ic-on').addClass('ic-off');
|
||||
$(o.parentNode).find('.api-ic.ic-on').removeClass('ic-on');
|
||||
|
||||
// sorry, not all scopes are satisfied
|
||||
$(o).find('.api-ic').addClass('ic-warning');
|
||||
$(o).find('.api-ic').removeClass('ic-error');
|
||||
}
|
||||
else {
|
||||
o = v.parentNode;
|
||||
$(o.parentNode).find('.api-ic.ic-off').addClass('ic-on');
|
||||
$(o.parentNode).find('.api-ic.ic-off').removeClass('ic-off');
|
||||
|
||||
// all scopes are satisfied
|
||||
$(o).find('.api-ic').addClass('ic-info');
|
||||
$(o).find('.api-ic').removeClass('ic-warning');
|
||||
$(o).find('.api-ic').removeClass('ic-error');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.authorizations.add("key", new ApiKeyAuthorization("Authorization", "Bearer " + b, "header"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+237
-28
@@ -1,5 +1,5 @@
|
||||
// swagger.js
|
||||
// version 2.0.17
|
||||
// version 2.0.30
|
||||
|
||||
var __bind = function(fn, me){
|
||||
return function(){
|
||||
@@ -15,6 +15,71 @@ log = function(){
|
||||
}
|
||||
};
|
||||
|
||||
if (!Array.prototype.indexOf) {
|
||||
Array.prototype.indexOf = function(obj, start) {
|
||||
for (var i = (start || 0), j = this.length; i < j; i++) {
|
||||
if (this[i] === obj) { return i; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!('filter' in Array.prototype)) {
|
||||
Array.prototype.filter= function(filter, that /*opt*/) {
|
||||
var other= [], v;
|
||||
for (var i=0, n= this.length; i<n; i++)
|
||||
if (i in this && filter.call(that, v= this[i], i, this))
|
||||
other.push(v);
|
||||
return other;
|
||||
};
|
||||
}
|
||||
|
||||
if (!('map' in Array.prototype)) {
|
||||
Array.prototype.map= function(mapper, that /*opt*/) {
|
||||
var other= new Array(this.length);
|
||||
for (var i= 0, n= this.length; i<n; i++)
|
||||
if (i in this)
|
||||
other[i]= mapper.call(that, this[i], i, this);
|
||||
return other;
|
||||
};
|
||||
}
|
||||
|
||||
Object.keys = Object.keys || (function () {
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty,
|
||||
hasDontEnumBug = !{toString:null}.propertyIsEnumerable("toString"),
|
||||
DontEnums = [
|
||||
'toString',
|
||||
'toLocaleString',
|
||||
'valueOf',
|
||||
'hasOwnProperty',
|
||||
'isPrototypeOf',
|
||||
'propertyIsEnumerable',
|
||||
'constructor'
|
||||
],
|
||||
DontEnumsLength = DontEnums.length;
|
||||
|
||||
return function (o) {
|
||||
if (typeof o != "object" && typeof o != "function" || o === null)
|
||||
throw new TypeError("Object.keys called on a non-object");
|
||||
|
||||
var result = [];
|
||||
for (var name in o) {
|
||||
if (hasOwnProperty.call(o, name))
|
||||
result.push(name);
|
||||
}
|
||||
|
||||
if (hasDontEnumBug) {
|
||||
for (var i = 0; i < DontEnumsLength; i++) {
|
||||
if (hasOwnProperty.call(o, DontEnums[i]))
|
||||
result.push(DontEnums[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
var SwaggerApi = function(url, options) {
|
||||
this.url = null;
|
||||
this.debug = false;
|
||||
@@ -95,10 +160,12 @@ SwaggerApi.prototype.buildFromSpec = function(response) {
|
||||
this.info = response.info;
|
||||
}
|
||||
var isApi = false;
|
||||
for (var i = 0; i < response.apis.length; i++) {
|
||||
var i;
|
||||
for (i = 0; i < response.apis.length; i++) {
|
||||
var api = response.apis[i];
|
||||
if (api.operations) {
|
||||
for (var j = 0; j < api.operations.length; j++) {
|
||||
var j;
|
||||
for (j = 0; j < api.operations.length; j++) {
|
||||
operation = api.operations[j];
|
||||
isApi = true;
|
||||
}
|
||||
@@ -118,7 +185,8 @@ SwaggerApi.prototype.buildFromSpec = function(response) {
|
||||
this.apis[newName] = res;
|
||||
this.apisArray.push(res);
|
||||
} else {
|
||||
for (var k = 0; k < response.apis.length; k++) {
|
||||
var k;
|
||||
for (k = 0; k < response.apis.length; k++) {
|
||||
var resource = response.apis[k];
|
||||
res = new SwaggerResource(resource, this);
|
||||
this.apis[res.name] = res;
|
||||
@@ -341,6 +409,7 @@ SwaggerResource.prototype.addApiDeclaration = function(response) {
|
||||
|
||||
SwaggerResource.prototype.addModels = function(models) {
|
||||
if (models != null) {
|
||||
var modelName;
|
||||
for (modelName in models) {
|
||||
if (this.models[modelName] == null) {
|
||||
var swaggerModel = new SwaggerModel(modelName, models[modelName]);
|
||||
@@ -420,6 +489,7 @@ SwaggerResource.prototype.sanitize = function(nickname) {
|
||||
SwaggerResource.prototype.help = function() {
|
||||
var op = this.operations;
|
||||
var output = [];
|
||||
var operation_name;
|
||||
for (operation_name in op) {
|
||||
operation = op[operation_name];
|
||||
var msg = " " + operation.nickname;
|
||||
@@ -435,8 +505,10 @@ SwaggerResource.prototype.help = function() {
|
||||
var SwaggerModel = function(modelName, obj) {
|
||||
this.name = obj.id != null ? obj.id : modelName;
|
||||
this.properties = [];
|
||||
var propertyName;
|
||||
for (propertyName in obj.properties) {
|
||||
if (obj.required != null) {
|
||||
var value;
|
||||
for (value in obj.required) {
|
||||
if (propertyName === obj.required[value]) {
|
||||
obj.properties[propertyName].required = true;
|
||||
@@ -490,15 +562,20 @@ SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
};
|
||||
|
||||
SwaggerModel.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result = {};
|
||||
var modelsToIgnore = (modelsToIgnore||[])
|
||||
modelsToIgnore.push(this.name);
|
||||
for (var i = 0; i < this.properties.length; i++) {
|
||||
prop = this.properties[i];
|
||||
result[prop.name] = prop.getSampleValue(modelsToIgnore);
|
||||
if(sampleModels[this.name]) {
|
||||
return sampleModels[this.name];
|
||||
}
|
||||
else {
|
||||
var result = {};
|
||||
var modelsToIgnore = (modelsToIgnore||[])
|
||||
modelsToIgnore.push(this.name);
|
||||
for (var i = 0; i < this.properties.length; i++) {
|
||||
prop = this.properties[i];
|
||||
result[prop.name] = prop.getSampleValue(modelsToIgnore);
|
||||
}
|
||||
modelsToIgnore.pop(this.name);
|
||||
return result;
|
||||
}
|
||||
modelsToIgnore.pop(this.name);
|
||||
return result;
|
||||
};
|
||||
|
||||
var SwaggerModelProperty = function(name, obj) {
|
||||
@@ -625,6 +702,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
if(type === 'array') {
|
||||
type = 'array[' + (param.items.$ref ? param.items.$ref : param.items.type) + ']';
|
||||
}
|
||||
param.type = type;
|
||||
|
||||
if(type.toLowerCase() === 'boolean') {
|
||||
param.allowableValues = {};
|
||||
@@ -720,7 +798,22 @@ SwaggerOperation.prototype.getSampleJSON = function(type, models) {
|
||||
val = isPrimitive ? void 0 : (listType != null ? models[listType].createJSONSample() : models[type].createJSONSample());
|
||||
if (val) {
|
||||
val = listType ? [val] : val;
|
||||
return JSON.stringify(val, null, 2);
|
||||
if(typeof val == "string")
|
||||
return val;
|
||||
else if(typeof val === "object") {
|
||||
var t = val;
|
||||
if(val instanceof Array && val.length > 0) {
|
||||
t = val[0];
|
||||
}
|
||||
if(t.nodeName) {
|
||||
var xmlString = new XMLSerializer().serializeToString(t);
|
||||
return this.formatXml(xmlString);
|
||||
}
|
||||
else
|
||||
return JSON.stringify(val, null, 2);
|
||||
}
|
||||
else
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -784,6 +877,7 @@ SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
|
||||
}
|
||||
|
||||
if (possibleParams) {
|
||||
var key;
|
||||
for (key in possibleParams) {
|
||||
value = possibleParams[key];
|
||||
if (args[value.name]) {
|
||||
@@ -808,6 +902,21 @@ SwaggerOperation.prototype.pathXml = function() {
|
||||
return this.path.replace("{format}", "xml");
|
||||
};
|
||||
|
||||
SwaggerOperation.prototype.encodePathParam = function(pathParam) {
|
||||
var encParts, part, parts, _i, _len;
|
||||
if (pathParam.indexOf("/") === -1) {
|
||||
return encodeURIComponent(pathParam);
|
||||
} else {
|
||||
parts = pathParam.split("/");
|
||||
encParts = [];
|
||||
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
||||
part = parts[_i];
|
||||
encParts.push(encodeURIComponent(part));
|
||||
}
|
||||
return encParts.join("/");
|
||||
}
|
||||
};
|
||||
|
||||
SwaggerOperation.prototype.urlify = function(args) {
|
||||
var url = this.resource.basePath + this.pathJson();
|
||||
var params = this.parameters;
|
||||
@@ -817,7 +926,7 @@ SwaggerOperation.prototype.urlify = function(args) {
|
||||
if(args[param.name]) {
|
||||
// apply path params and remove from args
|
||||
var reg = new RegExp('\{' + param.name + '[^\}]*\}', 'gi');
|
||||
url = url.replace(reg, encodeURIComponent(args[param.name]));
|
||||
url = url.replace(reg, this.encodePathParam(args[param.name]));
|
||||
delete args[param.name];
|
||||
}
|
||||
else
|
||||
@@ -829,10 +938,11 @@ SwaggerOperation.prototype.urlify = function(args) {
|
||||
for(var i = 0; i < params.length; i ++){
|
||||
var param = params[i];
|
||||
if(param.paramType === 'query') {
|
||||
if(queryParams !== '')
|
||||
queryParams += "&";
|
||||
if(args[param.name] !== undefined)
|
||||
if (args[param.name] !== undefined) {
|
||||
if (queryParams !== '')
|
||||
queryParams += "&";
|
||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((queryParams != null) && queryParams.length > 0)
|
||||
@@ -865,6 +975,7 @@ SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args) {
|
||||
matchingParams[param.name] = args[param.name];
|
||||
}
|
||||
var headers = this.resource.api.headers;
|
||||
var name;
|
||||
for (name in headers) {
|
||||
var value = headers[name];
|
||||
matchingParams[name] = value;
|
||||
@@ -884,6 +995,80 @@ SwaggerOperation.prototype.help = function() {
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
||||
SwaggerOperation.prototype.formatXml = function(xml) {
|
||||
var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
|
||||
reg = /(>)(<)(\/*)/g;
|
||||
wsexp = /[ ]*(.*)[ ]+\n/g;
|
||||
contexp = /(<.+>)(.+\n)/g;
|
||||
xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
|
||||
pad = 0;
|
||||
formatted = '';
|
||||
lines = xml.split('\n');
|
||||
indent = 0;
|
||||
lastType = 'other';
|
||||
transitions = {
|
||||
'single->single': 0,
|
||||
'single->closing': -1,
|
||||
'single->opening': 0,
|
||||
'single->other': 0,
|
||||
'closing->single': 0,
|
||||
'closing->closing': -1,
|
||||
'closing->opening': 0,
|
||||
'closing->other': 0,
|
||||
'opening->single': 1,
|
||||
'opening->closing': 0,
|
||||
'opening->opening': 1,
|
||||
'opening->other': 1,
|
||||
'other->single': 0,
|
||||
'other->closing': -1,
|
||||
'other->opening': 0,
|
||||
'other->other': 0
|
||||
};
|
||||
_fn = function(ln) {
|
||||
var fromTo, j, key, padding, type, types, value;
|
||||
types = {
|
||||
single: Boolean(ln.match(/<.+\/>/)),
|
||||
closing: Boolean(ln.match(/<\/.+>/)),
|
||||
opening: Boolean(ln.match(/<[^!?].*>/))
|
||||
};
|
||||
type = ((function() {
|
||||
var _results;
|
||||
_results = [];
|
||||
for (key in types) {
|
||||
value = types[key];
|
||||
if (value) {
|
||||
_results.push(key);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
})())[0];
|
||||
type = type === void 0 ? 'other' : type;
|
||||
fromTo = lastType + '->' + type;
|
||||
lastType = type;
|
||||
padding = '';
|
||||
indent += transitions[fromTo];
|
||||
padding = ((function() {
|
||||
var _j, _ref5, _results;
|
||||
_results = [];
|
||||
for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
|
||||
_results.push(' ');
|
||||
}
|
||||
return _results;
|
||||
})()).join('');
|
||||
if (fromTo === 'opening->closing') {
|
||||
return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
|
||||
} else {
|
||||
return formatted += padding + ln + '\n';
|
||||
}
|
||||
};
|
||||
for (_i = 0, _len = lines.length; _i < _len; _i++) {
|
||||
ln = lines[_i];
|
||||
_fn(ln);
|
||||
}
|
||||
return formatted;
|
||||
};
|
||||
|
||||
var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
|
||||
var _this = this;
|
||||
var errors = [];
|
||||
@@ -948,7 +1133,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
||||
}
|
||||
}
|
||||
|
||||
responseContentType = null;
|
||||
var responseContentType = null;
|
||||
if (this.opts.responseContentType) {
|
||||
responseContentType = this.opts.responseContentType;
|
||||
} else {
|
||||
@@ -963,24 +1148,28 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
||||
var fields = {};
|
||||
var possibleParams = {};
|
||||
var values = {};
|
||||
|
||||
for(var i = 0; i < formParams.length; i++){
|
||||
var param = formParams[i];
|
||||
var key;
|
||||
for(key in formParams){
|
||||
var param = formParams[key];
|
||||
values[param.name] = param;
|
||||
}
|
||||
|
||||
var encoded = "";
|
||||
var key;
|
||||
for(key in values) {
|
||||
value = this.params[key];
|
||||
if(encoded !== "")
|
||||
encoded += "&";
|
||||
encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||
if(typeof value !== 'undefined'){
|
||||
if(encoded !== "")
|
||||
encoded += "&";
|
||||
encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||
}
|
||||
}
|
||||
body = encoded
|
||||
body = encoded;
|
||||
}
|
||||
var name;
|
||||
for (name in this.headers)
|
||||
myHeaders[name] = this.headers[name];
|
||||
if (requestContentType)
|
||||
if ((requestContentType && body !== "") || (requestContentType === "application/x-www-form-urlencoded"))
|
||||
myHeaders["Content-Type"] = requestContentType;
|
||||
if (responseContentType)
|
||||
myHeaders["Accept"] = responseContentType;
|
||||
@@ -1029,6 +1218,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
||||
SwaggerRequest.prototype.asCurl = function() {
|
||||
var results = [];
|
||||
if(this.headers) {
|
||||
var key;
|
||||
for(key in this.headers) {
|
||||
results.push("--header \"" + key + ": " + this.headers[v] + "\"");
|
||||
}
|
||||
@@ -1083,6 +1273,7 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
var key, results;
|
||||
if (obj.headers) {
|
||||
results = [];
|
||||
var key;
|
||||
for (key in obj.headers) {
|
||||
if (key.toLowerCase() === "content-type") {
|
||||
results.push(obj.contentType = obj.headers[key]);
|
||||
@@ -1113,7 +1304,7 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
headers: headers
|
||||
};
|
||||
|
||||
var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null)
|
||||
var contentType = (headers["content-type"]||headers["Content-Type"]||null)
|
||||
|
||||
if(contentType != null) {
|
||||
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
|
||||
@@ -1250,6 +1441,7 @@ SwaggerAuthorizations.prototype.remove = function(name) {
|
||||
|
||||
SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
|
||||
status = null;
|
||||
var key;
|
||||
for (key in this.authz) {
|
||||
value = this.authz[key];
|
||||
result = value.apply(obj, authorizations);
|
||||
@@ -1283,6 +1475,16 @@ ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
|
||||
}
|
||||
};
|
||||
|
||||
var CookieAuthorization = function(cookie) {
|
||||
this.cookie = cookie;
|
||||
}
|
||||
|
||||
CookieAuthorization.prototype.apply = function(obj, authorizations) {
|
||||
obj.cookieJar = obj.cookieJar || CookieJar();
|
||||
obj.cookieJar.setCookie(this.cookie);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Password Authorization is a basic auth implementation
|
||||
*/
|
||||
@@ -1298,17 +1500,23 @@ var PasswordAuthorization = function(name, username, password) {
|
||||
};
|
||||
|
||||
PasswordAuthorization.prototype.apply = function(obj, authorizations) {
|
||||
obj.headers["Authorization"] = "Basic " + this._btoa(this.username + ":" + this.password);
|
||||
var base64encoder = this._btoa;
|
||||
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
|
||||
return true;
|
||||
};
|
||||
|
||||
var e = (typeof window !== 'undefined' ? window : exports);
|
||||
|
||||
var sampleModels = {};
|
||||
var cookies = {};
|
||||
|
||||
e.SampleModels = sampleModels;
|
||||
e.SwaggerHttp = SwaggerHttp;
|
||||
e.SwaggerRequest = SwaggerRequest;
|
||||
e.authorizations = new SwaggerAuthorizations();
|
||||
e.ApiKeyAuthorization = ApiKeyAuthorization;
|
||||
e.PasswordAuthorization = PasswordAuthorization;
|
||||
e.CookieAuthorization = CookieAuthorization;
|
||||
e.JQueryHttpClient = JQueryHttpClient;
|
||||
e.ShredHttpClient = ShredHttpClient;
|
||||
e.SwaggerOperation = SwaggerOperation;
|
||||
@@ -1316,3 +1524,4 @@ e.SwaggerModel = SwaggerModel;
|
||||
e.SwaggerModelProperty = SwaggerModelProperty;
|
||||
e.SwaggerResource = SwaggerResource;
|
||||
e.SwaggerApi = SwaggerApi;
|
||||
|
||||
|
||||
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
<script>
|
||||
var qp = null;
|
||||
if(window.location.hash) {
|
||||
qp = location.hash.substring(1);
|
||||
}
|
||||
else {
|
||||
qp = location.search.substring(1);
|
||||
}
|
||||
qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
|
||||
function(key, value) {
|
||||
return key===""?value:decodeURIComponent(value) }
|
||||
):{}
|
||||
window.opener.onOAuthComplete(qp);
|
||||
window.close();
|
||||
</script>
|
||||
Vendored
+265
-131
@@ -1,3 +1,5 @@
|
||||
// swagger-ui.js
|
||||
// version 2.0.16
|
||||
$(function() {
|
||||
|
||||
// Helper function for vertically aligning DOM elements
|
||||
@@ -62,9 +64,14 @@ function clippyCopiedCallback(a) {
|
||||
}
|
||||
|
||||
// Logging function that accounts for browsers that don't have window.console
|
||||
function log() {
|
||||
if (window.console) console.log.apply(console,arguments);
|
||||
}
|
||||
log = function(){
|
||||
log.history = log.history || [];
|
||||
log.history.push(arguments);
|
||||
if(this.console){
|
||||
console.log( Array.prototype.slice.call(arguments) );
|
||||
}
|
||||
};
|
||||
|
||||
// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
|
||||
if (Function.prototype.bind && console && typeof console.log == "object") {
|
||||
[
|
||||
@@ -86,7 +93,7 @@ var Docs = {
|
||||
switch (fragments.length) {
|
||||
case 1:
|
||||
// Expand all operations for the resource and scroll to it
|
||||
// log('shebang resource:' + fragments[0]);
|
||||
log('shebang resource:' + fragments[0]);
|
||||
var dom_id = 'resource_' + fragments[0];
|
||||
|
||||
Docs.expandEndpointListForResource(fragments[0]);
|
||||
@@ -94,18 +101,18 @@ var Docs = {
|
||||
break;
|
||||
case 2:
|
||||
// Refer to the endpoint DOM element, e.g. #words_get_search
|
||||
// log('shebang endpoint: ' + fragments.join('_'));
|
||||
log('shebang endpoint: ' + fragments.join('_'));
|
||||
|
||||
// Expand Resource
|
||||
Docs.expandEndpointListForResource(fragments[0]);
|
||||
$("#"+dom_id).slideto({highlight: false});
|
||||
// Expand Resource
|
||||
Docs.expandEndpointListForResource(fragments[0]);
|
||||
$("#"+dom_id).slideto({highlight: false});
|
||||
|
||||
// Expand operation
|
||||
// Expand operation
|
||||
var li_dom_id = fragments.join('_');
|
||||
var li_content_dom_id = li_dom_id + "_content";
|
||||
|
||||
// log("li_dom_id " + li_dom_id);
|
||||
// log("li_content_dom_id " + li_content_dom_id);
|
||||
log("li_dom_id " + li_dom_id);
|
||||
log("li_content_dom_id " + li_content_dom_id);
|
||||
|
||||
Docs.expandOperation($('#'+li_content_dom_id));
|
||||
$('#'+li_dom_id).slideto({highlight: false});
|
||||
@@ -180,9 +187,7 @@ var Docs = {
|
||||
collapseOperation: function(elem) {
|
||||
elem.slideUp();
|
||||
}
|
||||
|
||||
};
|
||||
(function() {
|
||||
};(function() {
|
||||
var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
|
||||
templates['content_type'] = template(function (Handlebars,depth0,helpers,partials,data) {
|
||||
this.compilerInfo = [4,'>= 1.0.0'];
|
||||
@@ -312,7 +317,7 @@ function program8(depth0,data) {
|
||||
templates['operation'] = template(function (Handlebars,depth0,helpers,partials,data) {
|
||||
this.compilerInfo = [4,'>= 1.0.0'];
|
||||
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
var buffer = "", stack1, functionType="function", escapeExpression=this.escapeExpression, self=this;
|
||||
var buffer = "", stack1, options, functionType="function", escapeExpression=this.escapeExpression, self=this, blockHelperMissing=helpers.blockHelperMissing;
|
||||
|
||||
function program1(depth0,data) {
|
||||
|
||||
@@ -328,28 +333,67 @@ function program1(depth0,data) {
|
||||
function program3(depth0,data) {
|
||||
|
||||
|
||||
return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n ";
|
||||
return "\n <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
|
||||
}
|
||||
|
||||
function program5(depth0,data) {
|
||||
|
||||
var buffer = "", stack1;
|
||||
buffer += "\n <div id=\"api_information_panel\" style=\"top: 526px; left: 776px; display: none;\">\n ";
|
||||
stack1 = helpers.each.call(depth0, depth0, {hash:{},inverse:self.noop,fn:self.program(6, program6, data),data:data});
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n </div>\n ";
|
||||
return buffer;
|
||||
}
|
||||
function program6(depth0,data) {
|
||||
|
||||
var buffer = "", stack1, stack2;
|
||||
buffer += "\n <div title='";
|
||||
stack2 = ((stack1 = depth0.description),typeof stack1 === functionType ? stack1.apply(depth0) : stack1);
|
||||
if(stack2 || stack2 === 0) { buffer += stack2; }
|
||||
buffer += "'>"
|
||||
+ escapeExpression(((stack1 = depth0.scope),typeof stack1 === functionType ? stack1.apply(depth0) : stack1))
|
||||
+ "</div>\n ";
|
||||
return buffer;
|
||||
}
|
||||
|
||||
function program8(depth0,data) {
|
||||
|
||||
|
||||
return "</div>";
|
||||
}
|
||||
|
||||
function program10(depth0,data) {
|
||||
|
||||
|
||||
return "\n <div class='access'>\n <span class=\"api-ic ic-off\" title=\"click to authenticate\"></span>\n </div>\n ";
|
||||
}
|
||||
|
||||
function program12(depth0,data) {
|
||||
|
||||
|
||||
return "\n <h4>Response Class</h4>\n <p><span class=\"model-signature\" /></p>\n <br/>\n <div class=\"response-content-type\" />\n ";
|
||||
}
|
||||
|
||||
function program14(depth0,data) {
|
||||
|
||||
|
||||
return "\n <h4>Parameters</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th style=\"width: 100px; max-width: 100px\">Parameter</th>\n <th style=\"width: 310px; max-width: 310px\">Value</th>\n <th style=\"width: 200px; max-width: 200px\">Description</th>\n <th style=\"width: 100px; max-width: 100px\">Parameter Type</th>\n <th style=\"width: 220px; max-width: 230px\">Data Type</th>\n </tr>\n </thead>\n <tbody class=\"operation-params\">\n\n </tbody>\n </table>\n ";
|
||||
}
|
||||
|
||||
function program7(depth0,data) {
|
||||
function program16(depth0,data) {
|
||||
|
||||
|
||||
return "\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Error Status Codes</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n ";
|
||||
return "\n <div style='margin:0;padding:0;display:inline'></div>\n <h4>Response Messages</h4>\n <table class='fullwidth'>\n <thead>\n <tr>\n <th>HTTP Status Code</th>\n <th>Reason</th>\n <th>Response Model</th>\n </tr>\n </thead>\n <tbody class=\"operation-status\">\n \n </tbody>\n </table>\n ";
|
||||
}
|
||||
|
||||
function program9(depth0,data) {
|
||||
function program18(depth0,data) {
|
||||
|
||||
|
||||
return "\n ";
|
||||
}
|
||||
|
||||
function program11(depth0,data) {
|
||||
function program20(depth0,data) {
|
||||
|
||||
|
||||
return "\n <div class='sandbox_header'>\n <input class='submit' name='commit' type='button' value='Try it out!' />\n <a href='#' class='response_hider' style='display:none'>Hide Response</a>\n <img alt='Throbber' class='response_throbber' src='images/throbber.gif' style='display:none' />\n </div>\n ";
|
||||
@@ -360,111 +404,92 @@ function program11(depth0,data) {
|
||||
else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ " operation' id='";
|
||||
if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "'>\n <div class='heading'>\n <h3>\n <span class='http_method'>\n <a href='#!/";
|
||||
if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "/";
|
||||
if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "' class=\"toggleOperation\">";
|
||||
if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "</a>\n </span>\n <span class='path'>\n <a href='#!/";
|
||||
if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "/";
|
||||
if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "' class=\"toggleOperation\">";
|
||||
if (stack1 = helpers.path) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.path; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "</a>\n </span>\n </h3>\n <ul class='options'>\n <li>\n <a href='#!/";
|
||||
if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "/";
|
||||
if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "' class=\"toggleOperation\">";
|
||||
if (stack1 = helpers.summary) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.summary; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "</a>\n </li>\n </ul>\n </div>\n <div class='content' id='";
|
||||
if (stack1 = helpers.resourceName) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.resourceName; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.parentId) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.parentId; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.nickname) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.nickname; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.method) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.method; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_";
|
||||
if (stack1 = helpers.number) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.number; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_content' style='display:none'>\n ";
|
||||
stack1 = helpers['if'].call(depth0, depth0.notes, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n ";
|
||||
stack1 = helpers['if'].call(depth0, depth0.type, {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data});
|
||||
options = {hash:{},inverse:self.noop,fn:self.program(3, program3, data),data:data};
|
||||
if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
|
||||
else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n ";
|
||||
stack1 = helpers.each.call(depth0, depth0.oauth, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n ";
|
||||
options = {hash:{},inverse:self.noop,fn:self.program(8, program8, data),data:data};
|
||||
if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
|
||||
else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n ";
|
||||
options = {hash:{},inverse:self.noop,fn:self.program(10, program10, data),data:data};
|
||||
if (stack1 = helpers.oauth) { stack1 = stack1.call(depth0, options); }
|
||||
else { stack1 = depth0.oauth; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (!helpers.oauth) { stack1 = blockHelperMissing.call(depth0, stack1, options); }
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n ";
|
||||
stack1 = helpers['if'].call(depth0, depth0.type, {hash:{},inverse:self.noop,fn:self.program(12, program12, data),data:data});
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n <form accept-charset='UTF-8' class='sandbox'>\n <div style='margin:0;padding:0;display:inline'></div>\n ";
|
||||
stack1 = helpers['if'].call(depth0, depth0.parameters, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
|
||||
stack1 = helpers['if'].call(depth0, depth0.parameters, {hash:{},inverse:self.noop,fn:self.program(14, program14, data),data:data});
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n ";
|
||||
stack1 = helpers['if'].call(depth0, depth0.responseMessages, {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
|
||||
stack1 = helpers['if'].call(depth0, depth0.responseMessages, {hash:{},inverse:self.noop,fn:self.program(16, program16, data),data:data});
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n ";
|
||||
stack1 = helpers['if'].call(depth0, depth0.isReadOnly, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data});
|
||||
stack1 = helpers['if'].call(depth0, depth0.isReadOnly, {hash:{},inverse:self.program(20, program20, data),fn:self.program(18, program18, data),data:data});
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n </form>\n <div class='response' style='display:none'>\n <h4>Request URL</h4>\n <div class='block request_url'></div>\n <h4>Response Body</h4>\n <div class='block response_body'></div>\n <h4>Response Code</h4>\n <div class='block response_code'></div>\n <h4>Response Headers</h4>\n <div class='block response_headers'></div>\n </div>\n </div>\n </li>\n </ul>\n";
|
||||
return buffer;
|
||||
@@ -593,7 +618,7 @@ function program12(depth0,data) {
|
||||
templates['param_list'] = template(function (Handlebars,depth0,helpers,partials,data) {
|
||||
this.compilerInfo = [4,'>= 1.0.0'];
|
||||
helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
var buffer = "", stack1, stack2, self=this, functionType="function", escapeExpression=this.escapeExpression;
|
||||
var buffer = "", stack1, stack2, options, self=this, helperMissing=helpers.helperMissing, functionType="function", escapeExpression=this.escapeExpression;
|
||||
|
||||
function program1(depth0,data) {
|
||||
|
||||
@@ -624,23 +649,24 @@ function program6(depth0,data) {
|
||||
|
||||
function program8(depth0,data) {
|
||||
|
||||
var buffer = "", stack1;
|
||||
var buffer = "", stack1, stack2, options;
|
||||
buffer += "\n ";
|
||||
stack1 = helpers['if'].call(depth0, depth0.allowMultiple, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data});
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
options = {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data};
|
||||
stack2 = ((stack1 = helpers.isArray || depth0.isArray),stack1 ? stack1.call(depth0, depth0, options) : helperMissing.call(depth0, "isArray", depth0, options));
|
||||
if(stack2 || stack2 === 0) { buffer += stack2; }
|
||||
buffer += "\n ";
|
||||
return buffer;
|
||||
}
|
||||
function program9(depth0,data) {
|
||||
|
||||
|
||||
return "\n ";
|
||||
return "\n ";
|
||||
}
|
||||
|
||||
function program11(depth0,data) {
|
||||
|
||||
|
||||
return "\n <option selected=\"\" value=''></option>\n ";
|
||||
return "\n <option selected=\"\" value=''></option>\n ";
|
||||
}
|
||||
|
||||
function program13(depth0,data) {
|
||||
@@ -687,15 +713,16 @@ function program16(depth0,data) {
|
||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "</td>\n<td>\n <select ";
|
||||
stack1 = helpers['if'].call(depth0, depth0.allowMultiple, {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data});
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
options = {hash:{},inverse:self.noop,fn:self.program(1, program1, data),data:data};
|
||||
stack2 = ((stack1 = helpers.isArray || depth0.isArray),stack1 ? stack1.call(depth0, depth0, options) : helperMissing.call(depth0, "isArray", depth0, options));
|
||||
if(stack2 || stack2 === 0) { buffer += stack2; }
|
||||
buffer += " class='parameter' name='";
|
||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
if (stack2 = helpers.name) { stack2 = stack2.call(depth0, {hash:{},data:data}); }
|
||||
else { stack2 = depth0.name; stack2 = typeof stack2 === functionType ? stack2.apply(depth0) : stack2; }
|
||||
buffer += escapeExpression(stack2)
|
||||
+ "'>\n ";
|
||||
stack1 = helpers['if'].call(depth0, depth0.required, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data),data:data});
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
stack2 = helpers['if'].call(depth0, depth0.required, {hash:{},inverse:self.program(5, program5, data),fn:self.program(3, program3, data),data:data});
|
||||
if(stack2 || stack2 === 0) { buffer += stack2; }
|
||||
buffer += "\n ";
|
||||
stack2 = helpers.each.call(depth0, ((stack1 = depth0.allowableValues),stack1 == null || stack1 === false ? stack1 : stack1.descriptiveValues), {hash:{},inverse:self.noop,fn:self.program(13, program13, data),data:data});
|
||||
if(stack2 || stack2 === 0) { buffer += stack2; }
|
||||
@@ -1042,12 +1069,12 @@ function program1(depth0,data) {
|
||||
}
|
||||
|
||||
buffer += "<div class='heading'>\n <h2>\n <a href='#!/";
|
||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "' onclick=\"Docs.toggleEndpointListForResource('";
|
||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "');\">";
|
||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
@@ -1063,32 +1090,32 @@ function program1(depth0,data) {
|
||||
else { stack1 = depth0.description; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "\n </h2>\n <ul class='options'>\n <li>\n <a href='#!/";
|
||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "' id='endpointListTogger_";
|
||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "'\n onclick=\"Docs.toggleEndpointListForResource('";
|
||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "');\">Show/Hide</a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.collapseOperationsForResource('";
|
||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "'); return false;\">\n List Operations\n </a>\n </li>\n <li>\n <a href='#' onclick=\"Docs.expandOperationsForResource('";
|
||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "'); return false;\">\n Expand Operations\n </a>\n </li>\n <li>\n <a href='";
|
||||
if (stack1 = helpers.url) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.url; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "'>Raw</a>\n </li>\n </ul>\n</div>\n<ul class='endpoints' id='";
|
||||
if (stack1 = helpers.name) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.name; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if (stack1 = helpers.id) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.id; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
buffer += escapeExpression(stack1)
|
||||
+ "_endpoint_list' style='display:none'>\n\n</ul>\n";
|
||||
return buffer;
|
||||
@@ -1175,7 +1202,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
|
||||
else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
|
||||
if(stack1 || stack1 === 0) { buffer += stack1; }
|
||||
buffer += "</td>\n";
|
||||
buffer += "</td>\n<td width='50%'><span class=\"model-signature\" /></td>";
|
||||
return buffer;
|
||||
});
|
||||
})();
|
||||
@@ -1405,11 +1432,20 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
MainView.prototype.initialize = function() {};
|
||||
|
||||
MainView.prototype.render = function() {
|
||||
var resource, _i, _len, _ref3;
|
||||
var counter, id, resource, resources, _i, _len, _ref3;
|
||||
$(this.el).html(Handlebars.templates.main(this.model));
|
||||
resources = {};
|
||||
counter = 0;
|
||||
_ref3 = this.model.apisArray;
|
||||
for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
|
||||
resource = _ref3[_i];
|
||||
id = resource.name;
|
||||
while (typeof resources[id] !== 'undefined') {
|
||||
id = id + "_" + counter;
|
||||
counter += 1;
|
||||
}
|
||||
resource.id = id;
|
||||
resources[id] = resource;
|
||||
this.addResource(resource);
|
||||
}
|
||||
return this;
|
||||
@@ -1420,7 +1456,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
resourceView = new ResourceView({
|
||||
model: resource,
|
||||
tagName: 'li',
|
||||
id: 'resource_' + resource.name,
|
||||
id: 'resource_' + resource.id,
|
||||
className: 'resource'
|
||||
});
|
||||
return $('#resources').append(resourceView.render().el);
|
||||
@@ -1445,12 +1481,21 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
ResourceView.prototype.initialize = function() {};
|
||||
|
||||
ResourceView.prototype.render = function() {
|
||||
var operation, _i, _len, _ref4;
|
||||
var counter, id, methods, operation, _i, _len, _ref4;
|
||||
$(this.el).html(Handlebars.templates.resource(this.model));
|
||||
this.number = 0;
|
||||
methods = {};
|
||||
_ref4 = this.model.operationsArray;
|
||||
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
|
||||
operation = _ref4[_i];
|
||||
counter = 0;
|
||||
id = operation.nickname;
|
||||
while (typeof methods[id] !== 'undefined') {
|
||||
id = id + "_" + counter;
|
||||
counter += 1;
|
||||
}
|
||||
methods[id] = operation;
|
||||
operation.nickname = id;
|
||||
operation.parentId = this.model.id;
|
||||
this.addOperation(operation);
|
||||
}
|
||||
return this;
|
||||
@@ -1486,17 +1531,72 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
'submit .sandbox': 'submitOperation',
|
||||
'click .submit': 'submitOperation',
|
||||
'click .response_hider': 'hideResponse',
|
||||
'click .toggleOperation': 'toggleOperationContent'
|
||||
'click .toggleOperation': 'toggleOperationContent',
|
||||
'mouseenter .api-ic': 'mouseEnter',
|
||||
'mouseout .api-ic': 'mouseExit'
|
||||
};
|
||||
|
||||
OperationView.prototype.initialize = function() {};
|
||||
|
||||
OperationView.prototype.mouseEnter = function(e) {
|
||||
var elem, hgh, pos, scMaxX, scMaxY, scX, scY, wd, x, y;
|
||||
elem = $(e.currentTarget.parentNode).find('#api_information_panel');
|
||||
x = event.pageX;
|
||||
y = event.pageY;
|
||||
scX = $(window).scrollLeft();
|
||||
scY = $(window).scrollTop();
|
||||
scMaxX = scX + $(window).width();
|
||||
scMaxY = scY + $(window).height();
|
||||
wd = elem.width();
|
||||
hgh = elem.height();
|
||||
if (x + wd > scMaxX) {
|
||||
x = scMaxX - wd;
|
||||
}
|
||||
if (x < scX) {
|
||||
x = scX;
|
||||
}
|
||||
if (y + hgh > scMaxY) {
|
||||
y = scMaxY - hgh;
|
||||
}
|
||||
if (y < scY) {
|
||||
y = scY;
|
||||
}
|
||||
pos = {};
|
||||
pos.top = y;
|
||||
pos.left = x;
|
||||
elem.css(pos);
|
||||
return $(e.currentTarget.parentNode).find('#api_information_panel').show();
|
||||
};
|
||||
|
||||
OperationView.prototype.mouseExit = function(e) {
|
||||
return $(e.currentTarget.parentNode).find('#api_information_panel').hide();
|
||||
};
|
||||
|
||||
OperationView.prototype.render = function() {
|
||||
var contentTypeModel, isMethodSubmissionSupported, param, responseContentTypeView, responseSignatureView, signatureModel, statusCode, type, _i, _j, _k, _len, _len1, _len2, _ref5, _ref6, _ref7;
|
||||
var contentTypeModel, isMethodSubmissionSupported, k, o, param, responseContentTypeView, responseSignatureView, signatureModel, statusCode, type, v, _i, _j, _k, _l, _len, _len1, _len2, _len3, _ref5, _ref6, _ref7, _ref8;
|
||||
isMethodSubmissionSupported = true;
|
||||
if (!isMethodSubmissionSupported) {
|
||||
this.model.isReadOnly = true;
|
||||
}
|
||||
this.model.oauth = null;
|
||||
if (this.model.authorizations) {
|
||||
_ref5 = this.model.authorizations;
|
||||
for (k in _ref5) {
|
||||
v = _ref5[k];
|
||||
if (k === "oauth2") {
|
||||
if (this.model.oauth === null) {
|
||||
this.model.oauth = {};
|
||||
}
|
||||
if (this.model.oauth.scopes === void 0) {
|
||||
this.model.oauth.scopes = [];
|
||||
}
|
||||
for (_i = 0, _len = v.length; _i < _len; _i++) {
|
||||
o = v[_i];
|
||||
this.model.oauth.scopes.push(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$(this.el).html(Handlebars.templates.operation(this.model));
|
||||
if (this.model.responseClassSignature && this.model.responseClassSignature !== 'string') {
|
||||
signatureModel = {
|
||||
@@ -1517,9 +1617,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
};
|
||||
contentTypeModel.consumes = this.model.consumes;
|
||||
contentTypeModel.produces = this.model.produces;
|
||||
_ref5 = this.model.parameters;
|
||||
for (_i = 0, _len = _ref5.length; _i < _len; _i++) {
|
||||
param = _ref5[_i];
|
||||
_ref6 = this.model.parameters;
|
||||
for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
|
||||
param = _ref6[_j];
|
||||
type = param.type || param.dataType;
|
||||
if (type.toLowerCase() === 'file') {
|
||||
if (!contentTypeModel.consumes) {
|
||||
@@ -1532,14 +1632,14 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
model: contentTypeModel
|
||||
});
|
||||
$('.response-content-type', $(this.el)).append(responseContentTypeView.render().el);
|
||||
_ref6 = this.model.parameters;
|
||||
for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
|
||||
param = _ref6[_j];
|
||||
_ref7 = this.model.parameters;
|
||||
for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
|
||||
param = _ref7[_k];
|
||||
this.addParameter(param, contentTypeModel.consumes);
|
||||
}
|
||||
_ref7 = this.model.responseMessages;
|
||||
for (_k = 0, _len2 = _ref7.length; _k < _len2; _k++) {
|
||||
statusCode = _ref7[_k];
|
||||
_ref8 = this.model.responseMessages;
|
||||
for (_l = 0, _len3 = _ref8.length; _l < _len3; _l++) {
|
||||
statusCode = _ref8[_l];
|
||||
this.addStatusCode(statusCode);
|
||||
}
|
||||
return this;
|
||||
@@ -1647,7 +1747,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
for (_j = 0, _len1 = _ref6.length; _j < _len1; _j++) {
|
||||
param = _ref6[_j];
|
||||
if (param.paramType === 'form') {
|
||||
bodyParam.append(param.name, map[param.name]);
|
||||
if (map[param.name] !== void 0) {
|
||||
bodyParam.append(param.name, map[param.name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
headerParams = {};
|
||||
@@ -1693,11 +1795,15 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
};
|
||||
|
||||
OperationView.prototype.wrap = function(data) {
|
||||
var headerArray, headers, i, o, _i, _ref5, _ref6;
|
||||
var h, headerArray, headers, i, o, _i, _len;
|
||||
headers = {};
|
||||
headerArray = data.getAllResponseHeaders().split(":");
|
||||
for (i = _i = 0, _ref5 = headerArray.length / 2, _ref6 = 2.; _ref6 > 0 ? _i <= _ref5 : _i >= _ref5; i = _i += _ref6) {
|
||||
headers[headerArray[i]] = headerArray[i + 1];
|
||||
headerArray = data.getAllResponseHeaders().split("\r");
|
||||
for (_i = 0, _len = headerArray.length; _i < _len; _i++) {
|
||||
i = headerArray[_i];
|
||||
h = i.split(':');
|
||||
if (h[0] !== void 0 && h[1] !== void 0) {
|
||||
headers[h[0].trim()] = h[1].trim();
|
||||
}
|
||||
}
|
||||
o = {};
|
||||
o.content = {};
|
||||
@@ -1826,8 +1932,14 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
};
|
||||
|
||||
OperationView.prototype.showStatus = function(response) {
|
||||
var code, content, contentType, headers, pre, response_body;
|
||||
content = response.data;
|
||||
var code, content, contentType, headers, pre, response_body, url;
|
||||
if (response.content === void 0) {
|
||||
content = response.data;
|
||||
url = response.url;
|
||||
} else {
|
||||
content = response.content.data;
|
||||
url = response.request.url;
|
||||
}
|
||||
headers = response.headers;
|
||||
contentType = headers && headers["Content-Type"] ? headers["Content-Type"].split(";")[0].trim() : null;
|
||||
if (!content) {
|
||||
@@ -1843,13 +1955,13 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
code = $('<code />').html(content);
|
||||
pre = $('<pre class="xml" />').append(code);
|
||||
} else if (/^image\//.test(contentType)) {
|
||||
pre = $('<img>').attr('src', response.url);
|
||||
pre = $('<img>').attr('src', url);
|
||||
} else {
|
||||
code = $('<code />').text(content);
|
||||
pre = $('<pre class="json" />').append(code);
|
||||
}
|
||||
response_body = pre;
|
||||
$(".request_url", $(this.el)).html("<pre>" + response.url + "</pre>");
|
||||
$(".request_url", $(this.el)).html("<pre>" + url + "</pre>");
|
||||
$(".response_code", $(this.el)).html("<pre>" + response.status + "</pre>");
|
||||
$(".response_body", $(this.el)).html(response_body);
|
||||
$(".response_headers", $(this.el)).html("<pre>" + JSON.stringify(response.headers, null, " ").replace(/\n/g, "<br>") + "</pre>");
|
||||
@@ -1861,7 +1973,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
|
||||
OperationView.prototype.toggleOperationContent = function() {
|
||||
var elem;
|
||||
elem = $('#' + Docs.escapeResourceName(this.model.resourceName) + "_" + this.model.nickname + "_" + this.model.method + "_" + this.model.number + "_content");
|
||||
elem = $('#' + Docs.escapeResourceName(this.model.parentId) + "_" + this.model.nickname + "_content");
|
||||
if (elem.is(':visible')) {
|
||||
return Docs.collapseOperation(elem);
|
||||
} else {
|
||||
@@ -1884,9 +1996,23 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
StatusCodeView.prototype.initialize = function() {};
|
||||
|
||||
StatusCodeView.prototype.render = function() {
|
||||
var template;
|
||||
var responseModel, responseModelView, template;
|
||||
template = this.template();
|
||||
$(this.el).html(template(this.model));
|
||||
if (swaggerUi.api.models.hasOwnProperty(this.model.responseModel)) {
|
||||
responseModel = {
|
||||
sampleJSON: JSON.stringify(swaggerUi.api.models[this.model.responseModel].createJSONSample(), null, 2),
|
||||
isParam: false,
|
||||
signature: swaggerUi.api.models[this.model.responseModel].getMockSignature()
|
||||
};
|
||||
responseModelView = new SignatureView({
|
||||
model: responseModel,
|
||||
tagName: 'div'
|
||||
});
|
||||
$('.model-signature', this.$el).append(responseModelView.render().el);
|
||||
} else {
|
||||
$('.model-signature', this.$el).html('');
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -1906,7 +2032,15 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
return _ref6;
|
||||
}
|
||||
|
||||
ParameterView.prototype.initialize = function() {};
|
||||
ParameterView.prototype.initialize = function() {
|
||||
return Handlebars.registerHelper('isArray', function(param, opts) {
|
||||
if (param.type.toLowerCase() === 'array' || param.allowMultiple) {
|
||||
return opts.fn(this);
|
||||
} else {
|
||||
return opts.inverse(this);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
ParameterView.prototype.render = function() {
|
||||
var contentTypeModel, isParam, parameterContentTypeView, responseContentTypeView, signatureModel, signatureView, template, type;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,7 @@
|
||||
var pack = require('./package');
|
||||
var path = require('path');
|
||||
|
||||
module.exports = {
|
||||
version: pack.version,
|
||||
dist: path.resolve(__dirname, 'dist')
|
||||
};
|
||||
@@ -0,0 +1,211 @@
|
||||
var appName;
|
||||
var popupMask;
|
||||
var popupDialog;
|
||||
var clientId;
|
||||
var realm;
|
||||
|
||||
function handleLogin() {
|
||||
var scopes = [];
|
||||
|
||||
if(window.swaggerUi.api.authSchemes
|
||||
&& window.swaggerUi.api.authSchemes.oauth2
|
||||
&& window.swaggerUi.api.authSchemes.oauth2.scopes) {
|
||||
scopes = window.swaggerUi.api.authSchemes.oauth2.scopes;
|
||||
}
|
||||
|
||||
if(window.swaggerUi.api
|
||||
&& window.swaggerUi.api.info) {
|
||||
appName = window.swaggerUi.api.info.title;
|
||||
}
|
||||
|
||||
if(popupDialog.length > 0)
|
||||
popupDialog = popupDialog.last();
|
||||
else {
|
||||
popupDialog = $(
|
||||
[
|
||||
'<div class="api-popup-dialog">',
|
||||
'<div class="api-popup-title">Select OAuth2.0 Scopes</div>',
|
||||
'<div class="api-popup-content">',
|
||||
'<p>Scopes are used to grant an application different levels of access to data on behalf of the end user. Each API may declare one or more scopes.',
|
||||
'<a href="#">Learn how to use</a>',
|
||||
'</p>',
|
||||
'<p><strong>' + appName + '</strong> API requires the following scopes. Select which ones you want to grant to Swagger UI.</p>',
|
||||
'<ul class="api-popup-scopes">',
|
||||
'</ul>',
|
||||
'<p class="error-msg"></p>',
|
||||
'<div class="api-popup-actions"><button class="api-popup-authbtn api-button green" type="button">Authorize</button><button class="api-popup-cancel api-button gray" type="button">Cancel</button></div>',
|
||||
'</div>',
|
||||
'</div>'].join(''));
|
||||
$(document.body).append(popupDialog);
|
||||
|
||||
popup = popupDialog.find('ul.api-popup-scopes').empty();
|
||||
for (i = 0; i < scopes.length; i ++) {
|
||||
scope = scopes[i];
|
||||
str = '<li><input type="checkbox" id="scope_' + i + '" scope="' + scope.scope + '"/>' + '<label for="scope_' + i + '">' + scope.scope;
|
||||
if (scope.description) {
|
||||
str += '<br/><span class="api-scope-desc">' + scope.description + '</span>';
|
||||
}
|
||||
str += '</label></li>';
|
||||
popup.append(str);
|
||||
}
|
||||
}
|
||||
|
||||
var $win = $(window),
|
||||
dw = $win.width(),
|
||||
dh = $win.height(),
|
||||
st = $win.scrollTop(),
|
||||
dlgWd = popupDialog.outerWidth(),
|
||||
dlgHt = popupDialog.outerHeight(),
|
||||
top = (dh -dlgHt)/2 + st,
|
||||
left = (dw - dlgWd)/2;
|
||||
|
||||
popupDialog.css({
|
||||
top: (top < 0? 0 : top) + 'px',
|
||||
left: (left < 0? 0 : left) + 'px'
|
||||
});
|
||||
|
||||
popupDialog.find('button.api-popup-cancel').click(function() {
|
||||
popupMask.hide();
|
||||
popupDialog.hide();
|
||||
});
|
||||
popupDialog.find('button.api-popup-authbtn').click(function() {
|
||||
popupMask.hide();
|
||||
popupDialog.hide();
|
||||
|
||||
var authSchemes = window.swaggerUi.api.authSchemes;
|
||||
var host = window.location;
|
||||
var redirectUrl = host.protocol + '//' + host.host + "/o2c.html";
|
||||
var url = null;
|
||||
|
||||
var p = window.swaggerUi.api.authSchemes;
|
||||
for (var key in p) {
|
||||
if (p.hasOwnProperty(key)) {
|
||||
var o = p[key].grantTypes;
|
||||
for(var t in o) {
|
||||
if(o.hasOwnProperty(t) && t === 'implicit') {
|
||||
var dets = o[t];
|
||||
url = dets.loginEndpoint.url + "?response_type=token";
|
||||
window.swaggerUi.tokenName = dets.tokenName;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
var scopes = []
|
||||
var o = $('.api-popup-scopes').find('input:checked');
|
||||
|
||||
for(k =0; k < o.length; k++) {
|
||||
scopes.push($(o[k]).attr("scope"));
|
||||
}
|
||||
|
||||
window.enabledScopes=scopes;
|
||||
|
||||
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
|
||||
url += '&realm=' + encodeURIComponent(realm);
|
||||
url += '&client_id=' + encodeURIComponent(clientId);
|
||||
url += '&scope=' + encodeURIComponent(scopes);
|
||||
|
||||
window.open(url);
|
||||
});
|
||||
|
||||
popupMask.show();
|
||||
popupDialog.show();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
function handleLogout() {
|
||||
for(key in window.authorizations.authz){
|
||||
window.authorizations.remove(key)
|
||||
}
|
||||
window.enabledScopes = null;
|
||||
$('.api-ic.ic-on').addClass('ic-off');
|
||||
$('.api-ic.ic-on').removeClass('ic-on');
|
||||
|
||||
// set the info box
|
||||
$('.api-ic.ic-warning').addClass('ic-error');
|
||||
$('.api-ic.ic-warning').removeClass('ic-warning');
|
||||
}
|
||||
|
||||
function initOAuth(opts) {
|
||||
var o = (opts||{});
|
||||
var errors = [];
|
||||
|
||||
appName = (o.appName||errors.push("missing appName"));
|
||||
popupMask = (o.popupMask||$('#api-common-mask'));
|
||||
popupDialog = (o.popupDialog||$('.api-popup-dialog'));
|
||||
clientId = (o.clientId||errors.push("missing client id"));
|
||||
realm = (o.realm||errors.push("missing realm"));
|
||||
|
||||
if(errors.length > 0){
|
||||
log("auth unable initialize oauth: " + errors);
|
||||
return;
|
||||
}
|
||||
|
||||
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
||||
$('.api-ic').click(function(s) {
|
||||
if($(s.target).hasClass('ic-off'))
|
||||
handleLogin();
|
||||
else {
|
||||
handleLogout();
|
||||
}
|
||||
false;
|
||||
});
|
||||
}
|
||||
|
||||
function onOAuthComplete(token) {
|
||||
if(token) {
|
||||
if(token.error) {
|
||||
var checkbox = $('input[type=checkbox],.secured')
|
||||
checkbox.each(function(pos){
|
||||
checkbox[pos].checked = false;
|
||||
});
|
||||
alert(token.error);
|
||||
}
|
||||
else {
|
||||
var b = token[window.swaggerUi.tokenName];
|
||||
if(b){
|
||||
// if all roles are satisfied
|
||||
var o = null;
|
||||
$.each($('.auth #api_information_panel'), function(k, v) {
|
||||
var children = v;
|
||||
if(children && children.childNodes) {
|
||||
var requiredScopes = [];
|
||||
$.each((children.childNodes), function (k1, v1){
|
||||
var inner = v1.innerHTML;
|
||||
if(inner)
|
||||
requiredScopes.push(inner);
|
||||
});
|
||||
var diff = [];
|
||||
for(var i=0; i < requiredScopes.length; i++) {
|
||||
var s = requiredScopes[i];
|
||||
if(window.enabledScopes && window.enabledScopes.indexOf(s) == -1) {
|
||||
diff.push(s);
|
||||
}
|
||||
}
|
||||
if(diff.length > 0){
|
||||
o = v.parentNode;
|
||||
$(o.parentNode).find('.api-ic.ic-on').addClass('ic-off');
|
||||
$(o.parentNode).find('.api-ic.ic-on').removeClass('ic-on');
|
||||
|
||||
// sorry, not all scopes are satisfied
|
||||
$(o).find('.api-ic').addClass('ic-warning');
|
||||
$(o).find('.api-ic').removeClass('ic-error');
|
||||
}
|
||||
else {
|
||||
o = v.parentNode;
|
||||
$(o.parentNode).find('.api-ic.ic-off').addClass('ic-on');
|
||||
$(o.parentNode).find('.api-ic.ic-off').removeClass('ic-off');
|
||||
|
||||
// all scopes are satisfied
|
||||
$(o).find('.api-ic').addClass('ic-info');
|
||||
$(o).find('.api-ic').removeClass('ic-warning');
|
||||
$(o).find('.api-ic').removeClass('ic-error');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.authorizations.add("key", new ApiKeyAuthorization("Authorization", "Bearer " + b, "header"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+237
-28
@@ -1,5 +1,5 @@
|
||||
// swagger.js
|
||||
// version 2.0.17
|
||||
// version 2.0.30
|
||||
|
||||
var __bind = function(fn, me){
|
||||
return function(){
|
||||
@@ -15,6 +15,71 @@ log = function(){
|
||||
}
|
||||
};
|
||||
|
||||
if (!Array.prototype.indexOf) {
|
||||
Array.prototype.indexOf = function(obj, start) {
|
||||
for (var i = (start || 0), j = this.length; i < j; i++) {
|
||||
if (this[i] === obj) { return i; }
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!('filter' in Array.prototype)) {
|
||||
Array.prototype.filter= function(filter, that /*opt*/) {
|
||||
var other= [], v;
|
||||
for (var i=0, n= this.length; i<n; i++)
|
||||
if (i in this && filter.call(that, v= this[i], i, this))
|
||||
other.push(v);
|
||||
return other;
|
||||
};
|
||||
}
|
||||
|
||||
if (!('map' in Array.prototype)) {
|
||||
Array.prototype.map= function(mapper, that /*opt*/) {
|
||||
var other= new Array(this.length);
|
||||
for (var i= 0, n= this.length; i<n; i++)
|
||||
if (i in this)
|
||||
other[i]= mapper.call(that, this[i], i, this);
|
||||
return other;
|
||||
};
|
||||
}
|
||||
|
||||
Object.keys = Object.keys || (function () {
|
||||
var hasOwnProperty = Object.prototype.hasOwnProperty,
|
||||
hasDontEnumBug = !{toString:null}.propertyIsEnumerable("toString"),
|
||||
DontEnums = [
|
||||
'toString',
|
||||
'toLocaleString',
|
||||
'valueOf',
|
||||
'hasOwnProperty',
|
||||
'isPrototypeOf',
|
||||
'propertyIsEnumerable',
|
||||
'constructor'
|
||||
],
|
||||
DontEnumsLength = DontEnums.length;
|
||||
|
||||
return function (o) {
|
||||
if (typeof o != "object" && typeof o != "function" || o === null)
|
||||
throw new TypeError("Object.keys called on a non-object");
|
||||
|
||||
var result = [];
|
||||
for (var name in o) {
|
||||
if (hasOwnProperty.call(o, name))
|
||||
result.push(name);
|
||||
}
|
||||
|
||||
if (hasDontEnumBug) {
|
||||
for (var i = 0; i < DontEnumsLength; i++) {
|
||||
if (hasOwnProperty.call(o, DontEnums[i]))
|
||||
result.push(DontEnums[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
|
||||
|
||||
var SwaggerApi = function(url, options) {
|
||||
this.url = null;
|
||||
this.debug = false;
|
||||
@@ -95,10 +160,12 @@ SwaggerApi.prototype.buildFromSpec = function(response) {
|
||||
this.info = response.info;
|
||||
}
|
||||
var isApi = false;
|
||||
for (var i = 0; i < response.apis.length; i++) {
|
||||
var i;
|
||||
for (i = 0; i < response.apis.length; i++) {
|
||||
var api = response.apis[i];
|
||||
if (api.operations) {
|
||||
for (var j = 0; j < api.operations.length; j++) {
|
||||
var j;
|
||||
for (j = 0; j < api.operations.length; j++) {
|
||||
operation = api.operations[j];
|
||||
isApi = true;
|
||||
}
|
||||
@@ -118,7 +185,8 @@ SwaggerApi.prototype.buildFromSpec = function(response) {
|
||||
this.apis[newName] = res;
|
||||
this.apisArray.push(res);
|
||||
} else {
|
||||
for (var k = 0; k < response.apis.length; k++) {
|
||||
var k;
|
||||
for (k = 0; k < response.apis.length; k++) {
|
||||
var resource = response.apis[k];
|
||||
res = new SwaggerResource(resource, this);
|
||||
this.apis[res.name] = res;
|
||||
@@ -341,6 +409,7 @@ SwaggerResource.prototype.addApiDeclaration = function(response) {
|
||||
|
||||
SwaggerResource.prototype.addModels = function(models) {
|
||||
if (models != null) {
|
||||
var modelName;
|
||||
for (modelName in models) {
|
||||
if (this.models[modelName] == null) {
|
||||
var swaggerModel = new SwaggerModel(modelName, models[modelName]);
|
||||
@@ -420,6 +489,7 @@ SwaggerResource.prototype.sanitize = function(nickname) {
|
||||
SwaggerResource.prototype.help = function() {
|
||||
var op = this.operations;
|
||||
var output = [];
|
||||
var operation_name;
|
||||
for (operation_name in op) {
|
||||
operation = op[operation_name];
|
||||
var msg = " " + operation.nickname;
|
||||
@@ -435,8 +505,10 @@ SwaggerResource.prototype.help = function() {
|
||||
var SwaggerModel = function(modelName, obj) {
|
||||
this.name = obj.id != null ? obj.id : modelName;
|
||||
this.properties = [];
|
||||
var propertyName;
|
||||
for (propertyName in obj.properties) {
|
||||
if (obj.required != null) {
|
||||
var value;
|
||||
for (value in obj.required) {
|
||||
if (propertyName === obj.required[value]) {
|
||||
obj.properties[propertyName].required = true;
|
||||
@@ -490,15 +562,20 @@ SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
};
|
||||
|
||||
SwaggerModel.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result = {};
|
||||
var modelsToIgnore = (modelsToIgnore||[])
|
||||
modelsToIgnore.push(this.name);
|
||||
for (var i = 0; i < this.properties.length; i++) {
|
||||
prop = this.properties[i];
|
||||
result[prop.name] = prop.getSampleValue(modelsToIgnore);
|
||||
if(sampleModels[this.name]) {
|
||||
return sampleModels[this.name];
|
||||
}
|
||||
else {
|
||||
var result = {};
|
||||
var modelsToIgnore = (modelsToIgnore||[])
|
||||
modelsToIgnore.push(this.name);
|
||||
for (var i = 0; i < this.properties.length; i++) {
|
||||
prop = this.properties[i];
|
||||
result[prop.name] = prop.getSampleValue(modelsToIgnore);
|
||||
}
|
||||
modelsToIgnore.pop(this.name);
|
||||
return result;
|
||||
}
|
||||
modelsToIgnore.pop(this.name);
|
||||
return result;
|
||||
};
|
||||
|
||||
var SwaggerModelProperty = function(name, obj) {
|
||||
@@ -625,6 +702,7 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
||||
if(type === 'array') {
|
||||
type = 'array[' + (param.items.$ref ? param.items.$ref : param.items.type) + ']';
|
||||
}
|
||||
param.type = type;
|
||||
|
||||
if(type.toLowerCase() === 'boolean') {
|
||||
param.allowableValues = {};
|
||||
@@ -720,7 +798,22 @@ SwaggerOperation.prototype.getSampleJSON = function(type, models) {
|
||||
val = isPrimitive ? void 0 : (listType != null ? models[listType].createJSONSample() : models[type].createJSONSample());
|
||||
if (val) {
|
||||
val = listType ? [val] : val;
|
||||
return JSON.stringify(val, null, 2);
|
||||
if(typeof val == "string")
|
||||
return val;
|
||||
else if(typeof val === "object") {
|
||||
var t = val;
|
||||
if(val instanceof Array && val.length > 0) {
|
||||
t = val[0];
|
||||
}
|
||||
if(t.nodeName) {
|
||||
var xmlString = new XMLSerializer().serializeToString(t);
|
||||
return this.formatXml(xmlString);
|
||||
}
|
||||
else
|
||||
return JSON.stringify(val, null, 2);
|
||||
}
|
||||
else
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -784,6 +877,7 @@ SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
|
||||
}
|
||||
|
||||
if (possibleParams) {
|
||||
var key;
|
||||
for (key in possibleParams) {
|
||||
value = possibleParams[key];
|
||||
if (args[value.name]) {
|
||||
@@ -808,6 +902,21 @@ SwaggerOperation.prototype.pathXml = function() {
|
||||
return this.path.replace("{format}", "xml");
|
||||
};
|
||||
|
||||
SwaggerOperation.prototype.encodePathParam = function(pathParam) {
|
||||
var encParts, part, parts, _i, _len;
|
||||
if (pathParam.indexOf("/") === -1) {
|
||||
return encodeURIComponent(pathParam);
|
||||
} else {
|
||||
parts = pathParam.split("/");
|
||||
encParts = [];
|
||||
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
||||
part = parts[_i];
|
||||
encParts.push(encodeURIComponent(part));
|
||||
}
|
||||
return encParts.join("/");
|
||||
}
|
||||
};
|
||||
|
||||
SwaggerOperation.prototype.urlify = function(args) {
|
||||
var url = this.resource.basePath + this.pathJson();
|
||||
var params = this.parameters;
|
||||
@@ -817,7 +926,7 @@ SwaggerOperation.prototype.urlify = function(args) {
|
||||
if(args[param.name]) {
|
||||
// apply path params and remove from args
|
||||
var reg = new RegExp('\{' + param.name + '[^\}]*\}', 'gi');
|
||||
url = url.replace(reg, encodeURIComponent(args[param.name]));
|
||||
url = url.replace(reg, this.encodePathParam(args[param.name]));
|
||||
delete args[param.name];
|
||||
}
|
||||
else
|
||||
@@ -829,10 +938,11 @@ SwaggerOperation.prototype.urlify = function(args) {
|
||||
for(var i = 0; i < params.length; i ++){
|
||||
var param = params[i];
|
||||
if(param.paramType === 'query') {
|
||||
if(queryParams !== '')
|
||||
queryParams += "&";
|
||||
if(args[param.name] !== undefined)
|
||||
if (args[param.name] !== undefined) {
|
||||
if (queryParams !== '')
|
||||
queryParams += "&";
|
||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((queryParams != null) && queryParams.length > 0)
|
||||
@@ -865,6 +975,7 @@ SwaggerOperation.prototype.getMatchingParams = function(paramTypes, args) {
|
||||
matchingParams[param.name] = args[param.name];
|
||||
}
|
||||
var headers = this.resource.api.headers;
|
||||
var name;
|
||||
for (name in headers) {
|
||||
var value = headers[name];
|
||||
matchingParams[name] = value;
|
||||
@@ -884,6 +995,80 @@ SwaggerOperation.prototype.help = function() {
|
||||
return msg;
|
||||
};
|
||||
|
||||
|
||||
SwaggerOperation.prototype.formatXml = function(xml) {
|
||||
var contexp, formatted, indent, lastType, lines, ln, pad, reg, transitions, wsexp, _fn, _i, _len;
|
||||
reg = /(>)(<)(\/*)/g;
|
||||
wsexp = /[ ]*(.*)[ ]+\n/g;
|
||||
contexp = /(<.+>)(.+\n)/g;
|
||||
xml = xml.replace(reg, '$1\n$2$3').replace(wsexp, '$1\n').replace(contexp, '$1\n$2');
|
||||
pad = 0;
|
||||
formatted = '';
|
||||
lines = xml.split('\n');
|
||||
indent = 0;
|
||||
lastType = 'other';
|
||||
transitions = {
|
||||
'single->single': 0,
|
||||
'single->closing': -1,
|
||||
'single->opening': 0,
|
||||
'single->other': 0,
|
||||
'closing->single': 0,
|
||||
'closing->closing': -1,
|
||||
'closing->opening': 0,
|
||||
'closing->other': 0,
|
||||
'opening->single': 1,
|
||||
'opening->closing': 0,
|
||||
'opening->opening': 1,
|
||||
'opening->other': 1,
|
||||
'other->single': 0,
|
||||
'other->closing': -1,
|
||||
'other->opening': 0,
|
||||
'other->other': 0
|
||||
};
|
||||
_fn = function(ln) {
|
||||
var fromTo, j, key, padding, type, types, value;
|
||||
types = {
|
||||
single: Boolean(ln.match(/<.+\/>/)),
|
||||
closing: Boolean(ln.match(/<\/.+>/)),
|
||||
opening: Boolean(ln.match(/<[^!?].*>/))
|
||||
};
|
||||
type = ((function() {
|
||||
var _results;
|
||||
_results = [];
|
||||
for (key in types) {
|
||||
value = types[key];
|
||||
if (value) {
|
||||
_results.push(key);
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
})())[0];
|
||||
type = type === void 0 ? 'other' : type;
|
||||
fromTo = lastType + '->' + type;
|
||||
lastType = type;
|
||||
padding = '';
|
||||
indent += transitions[fromTo];
|
||||
padding = ((function() {
|
||||
var _j, _ref5, _results;
|
||||
_results = [];
|
||||
for (j = _j = 0, _ref5 = indent; 0 <= _ref5 ? _j < _ref5 : _j > _ref5; j = 0 <= _ref5 ? ++_j : --_j) {
|
||||
_results.push(' ');
|
||||
}
|
||||
return _results;
|
||||
})()).join('');
|
||||
if (fromTo === 'opening->closing') {
|
||||
return formatted = formatted.substr(0, formatted.length - 1) + ln + '\n';
|
||||
} else {
|
||||
return formatted += padding + ln + '\n';
|
||||
}
|
||||
};
|
||||
for (_i = 0, _len = lines.length; _i < _len; _i++) {
|
||||
ln = lines[_i];
|
||||
_fn(ln);
|
||||
}
|
||||
return formatted;
|
||||
};
|
||||
|
||||
var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
|
||||
var _this = this;
|
||||
var errors = [];
|
||||
@@ -948,7 +1133,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
||||
}
|
||||
}
|
||||
|
||||
responseContentType = null;
|
||||
var responseContentType = null;
|
||||
if (this.opts.responseContentType) {
|
||||
responseContentType = this.opts.responseContentType;
|
||||
} else {
|
||||
@@ -963,24 +1148,28 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
||||
var fields = {};
|
||||
var possibleParams = {};
|
||||
var values = {};
|
||||
|
||||
for(var i = 0; i < formParams.length; i++){
|
||||
var param = formParams[i];
|
||||
var key;
|
||||
for(key in formParams){
|
||||
var param = formParams[key];
|
||||
values[param.name] = param;
|
||||
}
|
||||
|
||||
var encoded = "";
|
||||
var key;
|
||||
for(key in values) {
|
||||
value = this.params[key];
|
||||
if(encoded !== "")
|
||||
encoded += "&";
|
||||
encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||
if(typeof value !== 'undefined'){
|
||||
if(encoded !== "")
|
||||
encoded += "&";
|
||||
encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||
}
|
||||
}
|
||||
body = encoded
|
||||
body = encoded;
|
||||
}
|
||||
var name;
|
||||
for (name in this.headers)
|
||||
myHeaders[name] = this.headers[name];
|
||||
if (requestContentType)
|
||||
if ((requestContentType && body !== "") || (requestContentType === "application/x-www-form-urlencoded"))
|
||||
myHeaders["Content-Type"] = requestContentType;
|
||||
if (responseContentType)
|
||||
myHeaders["Accept"] = responseContentType;
|
||||
@@ -1029,6 +1218,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
||||
SwaggerRequest.prototype.asCurl = function() {
|
||||
var results = [];
|
||||
if(this.headers) {
|
||||
var key;
|
||||
for(key in this.headers) {
|
||||
results.push("--header \"" + key + ": " + this.headers[v] + "\"");
|
||||
}
|
||||
@@ -1083,6 +1273,7 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
var key, results;
|
||||
if (obj.headers) {
|
||||
results = [];
|
||||
var key;
|
||||
for (key in obj.headers) {
|
||||
if (key.toLowerCase() === "content-type") {
|
||||
results.push(obj.contentType = obj.headers[key]);
|
||||
@@ -1113,7 +1304,7 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
headers: headers
|
||||
};
|
||||
|
||||
var contentType = (response._headers["content-type"]||response._headers["Content-Type"]||null)
|
||||
var contentType = (headers["content-type"]||headers["Content-Type"]||null)
|
||||
|
||||
if(contentType != null) {
|
||||
if(contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
|
||||
@@ -1250,6 +1441,7 @@ SwaggerAuthorizations.prototype.remove = function(name) {
|
||||
|
||||
SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
|
||||
status = null;
|
||||
var key;
|
||||
for (key in this.authz) {
|
||||
value = this.authz[key];
|
||||
result = value.apply(obj, authorizations);
|
||||
@@ -1283,6 +1475,16 @@ ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
|
||||
}
|
||||
};
|
||||
|
||||
var CookieAuthorization = function(cookie) {
|
||||
this.cookie = cookie;
|
||||
}
|
||||
|
||||
CookieAuthorization.prototype.apply = function(obj, authorizations) {
|
||||
obj.cookieJar = obj.cookieJar || CookieJar();
|
||||
obj.cookieJar.setCookie(this.cookie);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Password Authorization is a basic auth implementation
|
||||
*/
|
||||
@@ -1298,17 +1500,23 @@ var PasswordAuthorization = function(name, username, password) {
|
||||
};
|
||||
|
||||
PasswordAuthorization.prototype.apply = function(obj, authorizations) {
|
||||
obj.headers["Authorization"] = "Basic " + this._btoa(this.username + ":" + this.password);
|
||||
var base64encoder = this._btoa;
|
||||
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
|
||||
return true;
|
||||
};
|
||||
|
||||
var e = (typeof window !== 'undefined' ? window : exports);
|
||||
|
||||
var sampleModels = {};
|
||||
var cookies = {};
|
||||
|
||||
e.SampleModels = sampleModels;
|
||||
e.SwaggerHttp = SwaggerHttp;
|
||||
e.SwaggerRequest = SwaggerRequest;
|
||||
e.authorizations = new SwaggerAuthorizations();
|
||||
e.ApiKeyAuthorization = ApiKeyAuthorization;
|
||||
e.PasswordAuthorization = PasswordAuthorization;
|
||||
e.CookieAuthorization = CookieAuthorization;
|
||||
e.JQueryHttpClient = JQueryHttpClient;
|
||||
e.ShredHttpClient = ShredHttpClient;
|
||||
e.SwaggerOperation = SwaggerOperation;
|
||||
@@ -1316,3 +1524,4 @@ e.SwaggerModel = SwaggerModel;
|
||||
e.SwaggerModelProperty = SwaggerModelProperty;
|
||||
e.SwaggerResource = SwaggerResource;
|
||||
e.SwaggerApi = SwaggerApi;
|
||||
|
||||
|
||||
+2
-2
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "swagger-ui",
|
||||
"version": "2.0.11",
|
||||
"version": "2.0.16",
|
||||
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
|
||||
"scripts": {
|
||||
"build": "PATH=$PATH:./node_modules/.bin cake dist",
|
||||
@@ -19,7 +19,7 @@
|
||||
"readmeFilename": "README.md",
|
||||
"dependencies": {
|
||||
"coffee-script": "~1.5.0",
|
||||
"swagger-client": "2.0.18",
|
||||
"swagger-client": "2.0.29",
|
||||
"handlebars": "~1.0.10",
|
||||
"less": "~1.4.2"
|
||||
}
|
||||
|
||||
@@ -6,12 +6,22 @@ class MainView extends Backbone.View
|
||||
$(@el).html(Handlebars.templates.main(@model))
|
||||
|
||||
# Render each resource
|
||||
@addResource resource for resource in @model.apisArray
|
||||
|
||||
resources = {}
|
||||
counter = 0
|
||||
for resource in @model.apisArray
|
||||
id = resource.name
|
||||
while typeof resources[id] isnt 'undefined'
|
||||
id = id + "_" + counter
|
||||
counter += 1
|
||||
resource.id = id
|
||||
resources[id] = resource
|
||||
@addResource resource
|
||||
@
|
||||
|
||||
addResource: (resource) ->
|
||||
# Render a resource and add it to resources li
|
||||
resourceView = new ResourceView({model: resource, tagName: 'li', id: 'resource_' + resource.name, className: 'resource'})
|
||||
resourceView = new ResourceView({model: resource, tagName: 'li', id: 'resource_' + resource.id, className: 'resource'})
|
||||
$('#resources').append resourceView.render().el
|
||||
|
||||
clear: ->
|
||||
|
||||
@@ -2,18 +2,59 @@ class OperationView extends Backbone.View
|
||||
invocationUrl: null
|
||||
|
||||
events: {
|
||||
'submit .sandbox' : 'submitOperation'
|
||||
'click .submit' : 'submitOperation'
|
||||
'click .response_hider' : 'hideResponse'
|
||||
'click .toggleOperation' : 'toggleOperationContent'
|
||||
'submit .sandbox' : 'submitOperation'
|
||||
'click .submit' : 'submitOperation'
|
||||
'click .response_hider' : 'hideResponse'
|
||||
'click .toggleOperation' : 'toggleOperationContent'
|
||||
'mouseenter .api-ic' : 'mouseEnter'
|
||||
'mouseout .api-ic' : 'mouseExit'
|
||||
}
|
||||
|
||||
initialize: ->
|
||||
|
||||
mouseEnter: (e) ->
|
||||
elem = $(e.currentTarget.parentNode).find('#api_information_panel')
|
||||
x = event.pageX
|
||||
y = event.pageY
|
||||
scX = $(window).scrollLeft()
|
||||
scY = $(window).scrollTop()
|
||||
scMaxX = scX + $(window).width()
|
||||
scMaxY = scY + $(window).height()
|
||||
wd = elem.width()
|
||||
hgh = elem.height()
|
||||
|
||||
if (x + wd > scMaxX)
|
||||
x = scMaxX - wd
|
||||
if (x < scX)
|
||||
x = scX
|
||||
if (y + hgh > scMaxY)
|
||||
y = scMaxY - hgh
|
||||
if (y < scY)
|
||||
y = scY
|
||||
pos = {}
|
||||
pos.top = y
|
||||
pos.left = x
|
||||
elem.css(pos)
|
||||
$(e.currentTarget.parentNode).find('#api_information_panel').show()
|
||||
|
||||
mouseExit: (e) ->
|
||||
$(e.currentTarget.parentNode).find('#api_information_panel').hide()
|
||||
|
||||
render: ->
|
||||
isMethodSubmissionSupported = true #jQuery.inArray(@model.method, @model.supportedSubmitMethods) >= 0
|
||||
@model.isReadOnly = true unless isMethodSubmissionSupported
|
||||
|
||||
@model.oauth = null
|
||||
if @model.authorizations
|
||||
for k, v of @model.authorizations
|
||||
if k == "oauth2"
|
||||
if @model.oauth == null
|
||||
@model.oauth = {}
|
||||
if @model.oauth.scopes is undefined
|
||||
@model.oauth.scopes = []
|
||||
for o in v
|
||||
@model.oauth.scopes.push o
|
||||
|
||||
$(@el).html(Handlebars.templates.operation(@model))
|
||||
|
||||
if @model.responseClassSignature and @model.responseClassSignature != 'string'
|
||||
@@ -121,7 +162,8 @@ class OperationView extends Backbone.View
|
||||
# add params
|
||||
for param in @model.parameters
|
||||
if param.paramType is 'form'
|
||||
bodyParam.append(param.name, map[param.name])
|
||||
if map[param.name] != undefined
|
||||
bodyParam.append(param.name, map[param.name])
|
||||
|
||||
# headers in operation
|
||||
headerParams = {}
|
||||
@@ -173,9 +215,11 @@ class OperationView extends Backbone.View
|
||||
|
||||
wrap: (data) ->
|
||||
headers = {}
|
||||
headerArray = data.getAllResponseHeaders().split(":")
|
||||
for i in [0..headerArray.length/2] by (2)
|
||||
headers[headerArray[i]] = headerArray[i+1]
|
||||
headerArray = data.getAllResponseHeaders().split("\r")
|
||||
for i in headerArray
|
||||
h = i.split(':')
|
||||
if (h[0] != undefined && h[1] != undefined)
|
||||
headers[h[0].trim()] = h[1].trim()
|
||||
|
||||
o = {}
|
||||
o.content = {}
|
||||
@@ -278,7 +322,12 @@ class OperationView extends Backbone.View
|
||||
|
||||
# puts the response data in UI
|
||||
showStatus: (response) ->
|
||||
content = response.data
|
||||
if response.content is undefined
|
||||
content = response.data
|
||||
url = response.url
|
||||
else
|
||||
content = response.content.data
|
||||
url = response.request.url
|
||||
headers = response.headers
|
||||
|
||||
# if server is nice, and sends content-type back, we can use it
|
||||
@@ -297,14 +346,14 @@ class OperationView extends Backbone.View
|
||||
code = $('<code />').html(content)
|
||||
pre = $('<pre class="xml" />').append(code)
|
||||
else if /^image\//.test(contentType)
|
||||
pre = $('<img>').attr('src',response.url)
|
||||
pre = $('<img>').attr('src',url)
|
||||
else
|
||||
# don't know what to render!
|
||||
code = $('<code />').text(content)
|
||||
pre = $('<pre class="json" />').append(code)
|
||||
|
||||
response_body = pre
|
||||
$(".request_url", $(@el)).html "<pre>" + response.url + "</pre>"
|
||||
$(".request_url", $(@el)).html "<pre>" + url + "</pre>"
|
||||
$(".response_code", $(@el)).html "<pre>" + response.status + "</pre>"
|
||||
$(".response_body", $(@el)).html response_body
|
||||
$(".response_headers", $(@el)).html "<pre>" + JSON.stringify(response.headers, null, " ").replace(/\n/g, "<br>") + "</pre>"
|
||||
@@ -314,5 +363,5 @@ class OperationView extends Backbone.View
|
||||
hljs.highlightBlock($('.response_body', $(@el))[0])
|
||||
|
||||
toggleOperationContent: ->
|
||||
elem = $('#' + Docs.escapeResourceName(@model.resourceName) + "_" + @model.nickname + "_" + @model.method + "_" + @model.number + "_content")
|
||||
elem = $('#' + Docs.escapeResourceName(@model.parentId) + "_" + @model.nickname + "_content")
|
||||
if elem.is(':visible') then Docs.collapseOperation(elem) else Docs.expandOperation(elem)
|
||||
|
||||
@@ -1,6 +1,12 @@
|
||||
class ParameterView extends Backbone.View
|
||||
initialize: ->
|
||||
|
||||
Handlebars.registerHelper 'isArray',
|
||||
(param, opts) ->
|
||||
if param.type.toLowerCase() == 'array' || param.allowMultiple
|
||||
opts.fn(@)
|
||||
else
|
||||
opts.inverse(@)
|
||||
|
||||
render: ->
|
||||
type = @model.type || @model.dataType
|
||||
@model.isBody = true if @model.paramType == 'body'
|
||||
|
||||
@@ -4,10 +4,22 @@ class ResourceView extends Backbone.View
|
||||
render: ->
|
||||
$(@el).html(Handlebars.templates.resource(@model))
|
||||
|
||||
@number = 0
|
||||
methods = {}
|
||||
|
||||
# Render each operation
|
||||
@addOperation operation for operation in @model.operationsArray
|
||||
for operation in @model.operationsArray
|
||||
counter = 0
|
||||
|
||||
id = operation.nickname
|
||||
while typeof methods[id] isnt 'undefined'
|
||||
id = id + "_" + counter
|
||||
counter += 1
|
||||
|
||||
methods[id] = operation
|
||||
|
||||
operation.nickname = id
|
||||
operation.parentId = @model.id
|
||||
@addOperation operation
|
||||
@
|
||||
|
||||
addOperation: (operation) ->
|
||||
|
||||
@@ -4,6 +4,17 @@ class StatusCodeView extends Backbone.View
|
||||
render: ->
|
||||
template = @template()
|
||||
$(@el).html(template(@model))
|
||||
|
||||
if swaggerUi.api.models.hasOwnProperty @model.responseModel
|
||||
responseModel =
|
||||
sampleJSON: JSON.stringify(swaggerUi.api.models[@model.responseModel].createJSONSample(), null, 2)
|
||||
isParam: false
|
||||
signature: swaggerUi.api.models[@model.responseModel].getMockSignature()
|
||||
|
||||
responseModelView = new SignatureView({model: responseModel, tagName: 'div'})
|
||||
$('.model-signature', @$el).append responseModelView.render().el
|
||||
else
|
||||
$('.model-signature', @$el).html ''
|
||||
@
|
||||
|
||||
template: ->
|
||||
|
||||
@@ -1,135 +0,0 @@
|
||||
/*
|
||||
|
||||
Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org>
|
||||
|
||||
*/
|
||||
|
||||
pre code {
|
||||
display: block; padding: 0.5em;
|
||||
background: #F0F0F0;
|
||||
}
|
||||
|
||||
pre code,
|
||||
pre .subst,
|
||||
pre .tag .title,
|
||||
pre .lisp .title,
|
||||
pre .clojure .built_in,
|
||||
pre .nginx .title {
|
||||
color: black;
|
||||
}
|
||||
|
||||
pre .string,
|
||||
pre .title,
|
||||
pre .constant,
|
||||
pre .parent,
|
||||
pre .tag .value,
|
||||
pre .rules .value,
|
||||
pre .rules .value .number,
|
||||
pre .preprocessor,
|
||||
pre .ruby .symbol,
|
||||
pre .ruby .symbol .string,
|
||||
pre .aggregate,
|
||||
pre .template_tag,
|
||||
pre .django .variable,
|
||||
pre .smalltalk .class,
|
||||
pre .addition,
|
||||
pre .flow,
|
||||
pre .stream,
|
||||
pre .bash .variable,
|
||||
pre .apache .tag,
|
||||
pre .apache .cbracket,
|
||||
pre .tex .command,
|
||||
pre .tex .special,
|
||||
pre .erlang_repl .function_or_atom,
|
||||
pre .markdown .header {
|
||||
color: #800;
|
||||
}
|
||||
|
||||
pre .comment,
|
||||
pre .annotation,
|
||||
pre .template_comment,
|
||||
pre .diff .header,
|
||||
pre .chunk,
|
||||
pre .markdown .blockquote {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
pre .number,
|
||||
pre .date,
|
||||
pre .regexp,
|
||||
pre .literal,
|
||||
pre .smalltalk .symbol,
|
||||
pre .smalltalk .char,
|
||||
pre .go .constant,
|
||||
pre .change,
|
||||
pre .markdown .bullet,
|
||||
pre .markdown .link_url {
|
||||
color: #080;
|
||||
}
|
||||
|
||||
pre .label,
|
||||
pre .javadoc,
|
||||
pre .ruby .string,
|
||||
pre .decorator,
|
||||
pre .filter .argument,
|
||||
pre .localvars,
|
||||
pre .array,
|
||||
pre .attr_selector,
|
||||
pre .important,
|
||||
pre .pseudo,
|
||||
pre .pi,
|
||||
pre .doctype,
|
||||
pre .deletion,
|
||||
pre .envvar,
|
||||
pre .shebang,
|
||||
pre .apache .sqbracket,
|
||||
pre .nginx .built_in,
|
||||
pre .tex .formula,
|
||||
pre .erlang_repl .reserved,
|
||||
pre .prompt,
|
||||
pre .markdown .link_label,
|
||||
pre .vhdl .attribute,
|
||||
pre .clojure .attribute,
|
||||
pre .coffeescript .property {
|
||||
color: #88F
|
||||
}
|
||||
|
||||
pre .keyword,
|
||||
pre .id,
|
||||
pre .phpdoc,
|
||||
pre .title,
|
||||
pre .built_in,
|
||||
pre .aggregate,
|
||||
pre .css .tag,
|
||||
pre .javadoctag,
|
||||
pre .phpdoc,
|
||||
pre .yardoctag,
|
||||
pre .smalltalk .class,
|
||||
pre .winutils,
|
||||
pre .bash .variable,
|
||||
pre .apache .tag,
|
||||
pre .go .typename,
|
||||
pre .tex .command,
|
||||
pre .markdown .strong,
|
||||
pre .request,
|
||||
pre .status {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
pre .markdown .emphasis {
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
pre .nginx .built_in {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
pre .coffeescript .javascript,
|
||||
pre .javascript .xml,
|
||||
pre .tex .formula,
|
||||
pre .xml .javascript,
|
||||
pre .xml .vbscript,
|
||||
pre .xml .css,
|
||||
pre .xml .cdata {
|
||||
opacity: 0.5;
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */
|
||||
html,
|
||||
body,
|
||||
div,
|
||||
span,
|
||||
applet,
|
||||
object,
|
||||
iframe,
|
||||
h1,
|
||||
h2,
|
||||
h3,
|
||||
h4,
|
||||
h5,
|
||||
h6,
|
||||
p,
|
||||
blockquote,
|
||||
pre,
|
||||
a,
|
||||
abbr,
|
||||
acronym,
|
||||
address,
|
||||
big,
|
||||
cite,
|
||||
code,
|
||||
del,
|
||||
dfn,
|
||||
em,
|
||||
img,
|
||||
ins,
|
||||
kbd,
|
||||
q,
|
||||
s,
|
||||
samp,
|
||||
small,
|
||||
strike,
|
||||
strong,
|
||||
sub,
|
||||
sup,
|
||||
tt,
|
||||
var,
|
||||
b,
|
||||
u,
|
||||
i,
|
||||
center,
|
||||
dl,
|
||||
dt,
|
||||
dd,
|
||||
ol,
|
||||
ul,
|
||||
li,
|
||||
fieldset,
|
||||
form,
|
||||
label,
|
||||
legend,
|
||||
table,
|
||||
caption,
|
||||
tbody,
|
||||
tfoot,
|
||||
thead,
|
||||
tr,
|
||||
th,
|
||||
td,
|
||||
article,
|
||||
aside,
|
||||
canvas,
|
||||
details,
|
||||
embed,
|
||||
figure,
|
||||
figcaption,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
menu,
|
||||
nav,
|
||||
output,
|
||||
ruby,
|
||||
section,
|
||||
summary,
|
||||
time,
|
||||
mark,
|
||||
audio,
|
||||
video {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
font-size: 100%;
|
||||
font: inherit;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
/* HTML5 display-role reset for older browsers */
|
||||
article,
|
||||
aside,
|
||||
details,
|
||||
figcaption,
|
||||
figure,
|
||||
footer,
|
||||
header,
|
||||
hgroup,
|
||||
menu,
|
||||
nav,
|
||||
section {
|
||||
display: block;
|
||||
}
|
||||
body {
|
||||
line-height: 1;
|
||||
}
|
||||
ol,
|
||||
ul {
|
||||
list-style: none;
|
||||
}
|
||||
blockquote,
|
||||
q {
|
||||
quotes: none;
|
||||
}
|
||||
blockquote:before,
|
||||
blockquote:after,
|
||||
q:before,
|
||||
q:after {
|
||||
content: '';
|
||||
content: none;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
+538
-387
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
After Width: | Height: | Size: 5.6 KiB |
+22
-15
@@ -3,7 +3,7 @@
|
||||
<head>
|
||||
<title>Swagger UI</title>
|
||||
<link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/highlight.default.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/reset.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/screen.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||
<script type="text/javascript" src="lib/shred.bundle.js"></script>
|
||||
<script src='lib/jquery-1.8.0.min.js' type='text/javascript'></script>
|
||||
@@ -16,6 +16,10 @@
|
||||
<script src='lib/swagger.js' type='text/javascript'></script>
|
||||
<script src='swagger-ui.js' type='text/javascript'></script>
|
||||
<script src='lib/highlight.7.3.pack.js' type='text/javascript'></script>
|
||||
|
||||
<!-- enabling this will enable oauth2 implicit scope support -->
|
||||
<script src='lib/swagger-oauth.js' type='text/javascript'></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function () {
|
||||
window.swaggerUi = new SwaggerUi({
|
||||
@@ -23,8 +27,20 @@
|
||||
dom_id: "swagger-ui-container",
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||
onComplete: function(swaggerApi, swaggerUi){
|
||||
log("Loaded SwaggerUI")
|
||||
$('pre code').each(function(i, e) {hljs.highlightBlock(e)});
|
||||
log("Loaded SwaggerUI");
|
||||
|
||||
if(typeof initOAuth == "function") {
|
||||
/*
|
||||
initOAuth({
|
||||
clientId: "your-client-id",
|
||||
realm: "your-realms",
|
||||
appName: "your-app-name"
|
||||
});
|
||||
*/
|
||||
}
|
||||
$('pre code').each(function(i, e) {
|
||||
hljs.highlightBlock(e)
|
||||
});
|
||||
},
|
||||
onFailure: function(data) {
|
||||
log("Unable to Load SwaggerUI");
|
||||
@@ -42,15 +58,13 @@
|
||||
})
|
||||
window.swaggerUi.load();
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="swagger-section">
|
||||
<div id='header'>
|
||||
<div class="swagger-ui-wrap">
|
||||
<a id="logo" href="http://swagger.wordnik.com">swagger</a>
|
||||
|
||||
<form id='api_selector'>
|
||||
<div class='input icon-btn'>
|
||||
<img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example Apis">
|
||||
@@ -65,14 +79,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="message-bar" class="swagger-ui-wrap">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="swagger-ui-container" class="swagger-ui-wrap">
|
||||
|
||||
</div>
|
||||
|
||||
<div id="message-bar" class="swagger-ui-wrap"> </div>
|
||||
<div id="swagger-ui-container" class="swagger-ui-wrap"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<script>
|
||||
var qp = null;
|
||||
if(window.location.hash) {
|
||||
qp = location.hash.substring(1);
|
||||
}
|
||||
else {
|
||||
qp = location.search.substring(1);
|
||||
}
|
||||
qp = qp ? JSON.parse('{"' + qp.replace(/&/g, '","').replace(/=/g,'":"') + '"}',
|
||||
function(key, value) {
|
||||
return key===""?value:decodeURIComponent(value) }
|
||||
):{}
|
||||
window.opener.onOAuthComplete(qp);
|
||||
window.close();
|
||||
</script>
|
||||
+17
-13
@@ -62,9 +62,14 @@ function clippyCopiedCallback(a) {
|
||||
}
|
||||
|
||||
// Logging function that accounts for browsers that don't have window.console
|
||||
function log() {
|
||||
if (window.console) console.log.apply(console,arguments);
|
||||
}
|
||||
log = function(){
|
||||
log.history = log.history || [];
|
||||
log.history.push(arguments);
|
||||
if(this.console){
|
||||
console.log( Array.prototype.slice.call(arguments) );
|
||||
}
|
||||
};
|
||||
|
||||
// Handle browsers that do console incorrectly (IE9 and below, see http://stackoverflow.com/a/5539378/7913)
|
||||
if (Function.prototype.bind && console && typeof console.log == "object") {
|
||||
[
|
||||
@@ -86,7 +91,7 @@ var Docs = {
|
||||
switch (fragments.length) {
|
||||
case 1:
|
||||
// Expand all operations for the resource and scroll to it
|
||||
// log('shebang resource:' + fragments[0]);
|
||||
log('shebang resource:' + fragments[0]);
|
||||
var dom_id = 'resource_' + fragments[0];
|
||||
|
||||
Docs.expandEndpointListForResource(fragments[0]);
|
||||
@@ -94,18 +99,18 @@ var Docs = {
|
||||
break;
|
||||
case 2:
|
||||
// Refer to the endpoint DOM element, e.g. #words_get_search
|
||||
// log('shebang endpoint: ' + fragments.join('_'));
|
||||
log('shebang endpoint: ' + fragments.join('_'));
|
||||
|
||||
// Expand Resource
|
||||
Docs.expandEndpointListForResource(fragments[0]);
|
||||
$("#"+dom_id).slideto({highlight: false});
|
||||
// Expand Resource
|
||||
Docs.expandEndpointListForResource(fragments[0]);
|
||||
$("#"+dom_id).slideto({highlight: false});
|
||||
|
||||
// Expand operation
|
||||
// Expand operation
|
||||
var li_dom_id = fragments.join('_');
|
||||
var li_content_dom_id = li_dom_id + "_content";
|
||||
|
||||
// log("li_dom_id " + li_dom_id);
|
||||
// log("li_content_dom_id " + li_content_dom_id);
|
||||
log("li_dom_id " + li_dom_id);
|
||||
log("li_content_dom_id " + li_content_dom_id);
|
||||
|
||||
Docs.expandOperation($('#'+li_content_dom_id));
|
||||
$('#'+li_dom_id).slideto({highlight: false});
|
||||
@@ -180,5 +185,4 @@ var Docs = {
|
||||
collapseOperation: function(elem) {
|
||||
elem.slideUp();
|
||||
}
|
||||
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,83 @@
|
||||
.swagger-section {
|
||||
|
||||
.title {
|
||||
font-style: bold;
|
||||
}
|
||||
|
||||
.secondary_form {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.main_image {
|
||||
display: block;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.oauth_body {
|
||||
margin-left: 100px;
|
||||
margin-right: 100px;
|
||||
}
|
||||
|
||||
.oauth_submit {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.api-popup-dialog {
|
||||
z-index: 10000;
|
||||
position: absolute;
|
||||
width: 500px;
|
||||
background: #FFF;
|
||||
padding: 20px;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
display: none;
|
||||
font-size: 13px;
|
||||
color: #777;
|
||||
|
||||
.api-popup-title{
|
||||
font-size: 24px;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
.api-popup-title{
|
||||
font-size: 24px;
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
|
||||
p.error-msg {
|
||||
padding-left: 5px;
|
||||
padding-bottom: 5px;
|
||||
}
|
||||
|
||||
button.api-popup-authbtn {
|
||||
height: 30px;
|
||||
}
|
||||
button.api-popup-cancel {
|
||||
height: 30px;
|
||||
}
|
||||
}
|
||||
|
||||
.api-popup-scopes {
|
||||
padding: 10px 20px;
|
||||
|
||||
li {
|
||||
padding: 5px 0;
|
||||
line-height: 20px;
|
||||
}
|
||||
|
||||
.api-scope-desc {
|
||||
padding-left: 20px;
|
||||
font-style: italic;
|
||||
}
|
||||
li input {
|
||||
position: relative;
|
||||
top: 2px;
|
||||
}
|
||||
}
|
||||
.api-popup-actions {
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,8 +1,6 @@
|
||||
/*
|
||||
/* Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org> */
|
||||
|
||||
Original style from softwaremaniacs.org (c) Ivan Sagalaev <Maniac@SoftwareManiacs.Org>
|
||||
|
||||
*/
|
||||
.swagger-section {
|
||||
|
||||
pre code {
|
||||
display: block; padding: 0.5em;
|
||||
@@ -133,3 +131,5 @@ pre .xml .css,
|
||||
pre .xml .cdata {
|
||||
opacity: 0.5;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
/* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 */
|
||||
|
||||
html, body, div, span, applet, object, iframe,
|
||||
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
|
||||
a, abbr, acronym, address, big, cite, code,
|
||||
|
||||
@@ -1,5 +1,75 @@
|
||||
@import 'src/main/less/reset.less';
|
||||
@import 'src/main/less/highlight_default.less';
|
||||
@import 'src/main/less/specs.less';
|
||||
@import 'src/main/less/auth.less';
|
||||
|
||||
.swagger-section {
|
||||
|
||||
.access {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.auth {
|
||||
float: right;
|
||||
}
|
||||
|
||||
#api_information_panel {
|
||||
position: absolute;
|
||||
background: #FFF;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 5px;
|
||||
display: none;
|
||||
font-size: 13px;
|
||||
max-width: 300px;
|
||||
line-height: 30px;
|
||||
color: black;
|
||||
padding: 5px;
|
||||
p {
|
||||
.api-msg-enabled {
|
||||
color: green;
|
||||
}
|
||||
.api-msg-disabled {
|
||||
color: red;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.api-ic {
|
||||
height: 18px;
|
||||
vertical-align: middle;
|
||||
display: inline-block;
|
||||
background: url(../images/explorer_icons.png) no-repeat;
|
||||
}
|
||||
|
||||
.ic-info {
|
||||
background-position: 0 0;
|
||||
width: 18px;
|
||||
margin-top: -7px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.ic-warning {
|
||||
background-position: -60px 0;
|
||||
width: 18px;
|
||||
margin-top: -7px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.ic-error {
|
||||
background-position: -30px 0;
|
||||
width: 18px;
|
||||
margin-top: -7px;
|
||||
margin-left: 4px;
|
||||
}
|
||||
.ic-off {
|
||||
background-position: -90px 0;
|
||||
width: 58px;
|
||||
margin-top: -4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
.ic-on {
|
||||
background-position: -160px 0;
|
||||
width: 58px;
|
||||
margin-top: -4px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
#header {
|
||||
background-color: #89bf04;
|
||||
@@ -64,4 +134,6 @@
|
||||
min-height: 30px;
|
||||
text-align: center;
|
||||
padding-top: 10px;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,3 +1,5 @@
|
||||
.swagger-section {
|
||||
|
||||
.swagger-ui-wrap {
|
||||
|
||||
line-height: 1;
|
||||
@@ -632,6 +634,11 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
ul.options {
|
||||
li.access {
|
||||
color: black;
|
||||
}
|
||||
}
|
||||
}
|
||||
div.content {
|
||||
border-top: none;
|
||||
@@ -914,6 +921,41 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
li.operation.options {
|
||||
div.heading {
|
||||
background-color: #e7f0f7;
|
||||
border: 1px solid #c3d9ec;
|
||||
h3 {
|
||||
span.http_method {
|
||||
a {
|
||||
background-color: #0f6ab4;
|
||||
}
|
||||
}
|
||||
}
|
||||
ul.options {
|
||||
li {
|
||||
border-right: 1px solid #dddddd;
|
||||
border-right-color: #c3d9ec;
|
||||
color: #0f6ab4;
|
||||
a {
|
||||
color: #0f6ab4;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
div.content {
|
||||
background-color: #ebf3f9;
|
||||
border: 1px solid #c3d9ec;
|
||||
h4 {
|
||||
color: #0f6ab4;
|
||||
}
|
||||
div.sandbox_header {
|
||||
a {
|
||||
color: #6fa5d2;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
li.operation {
|
||||
&.get, &.post, &.head, &.put, &.patch, &.delete {
|
||||
div.content {
|
||||
@@ -1000,5 +1042,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,26 +1,42 @@
|
||||
|
||||
<ul class='operations' >
|
||||
<li class='{{method}} operation' id='{{resourceName}}_{{nickname}}_{{method}}_{{number}}'>
|
||||
<li class='{{method}} operation' id='{{parentId}}_{{nickname}}'>
|
||||
<div class='heading'>
|
||||
<h3>
|
||||
<span class='http_method'>
|
||||
<a href='#!/{{resourceName}}/{{nickname}}_{{method}}_{{number}}' class="toggleOperation">{{method}}</a>
|
||||
<a href='#!/{{parentId}}/{{nickname}}' class="toggleOperation">{{method}}</a>
|
||||
</span>
|
||||
<span class='path'>
|
||||
<a href='#!/{{resourceName}}/{{nickname}}_{{method}}_{{number}}' class="toggleOperation">{{path}}</a>
|
||||
<a href='#!/{{parentId}}/{{nickname}}' class="toggleOperation">{{path}}</a>
|
||||
</span>
|
||||
</h3>
|
||||
<ul class='options'>
|
||||
<li>
|
||||
<a href='#!/{{resourceName}}/{{nickname}}_{{method}}_{{number}}' class="toggleOperation">{{{summary}}}</a>
|
||||
<a href='#!/{{parentId}}/{{nickname}}' class="toggleOperation">{{{summary}}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class='content' id='{{resourceName}}_{{nickname}}_{{method}}_{{number}}_content' style='display:none'>
|
||||
<div class='content' id='{{parentId}}_{{nickname}}_content' style='display:none'>
|
||||
{{#if notes}}
|
||||
<h4>Implementation Notes</h4>
|
||||
<p>{{{notes}}}</p>
|
||||
{{/if}}
|
||||
{{#oauth}}
|
||||
<div class="auth">
|
||||
<span class="api-ic ic-error"></span>{{/oauth}}
|
||||
{{#each oauth}}
|
||||
<div id="api_information_panel" style="top: 526px; left: 776px; display: none;">
|
||||
{{#each this}}
|
||||
<div title='{{{this.description}}}'>{{this.scope}}</div>
|
||||
{{/each}}
|
||||
</div>
|
||||
{{/each}}
|
||||
{{#oauth}}</div>{{/oauth}}
|
||||
{{#oauth}}
|
||||
<div class='access'>
|
||||
<span class="api-ic ic-off" title="click to authenticate"></span>
|
||||
</div>
|
||||
{{/oauth}}
|
||||
{{#if type}}
|
||||
<h4>Response Class</h4>
|
||||
<p><span class="model-signature" /></p>
|
||||
@@ -48,12 +64,13 @@
|
||||
{{/if}}
|
||||
{{#if responseMessages}}
|
||||
<div style='margin:0;padding:0;display:inline'></div>
|
||||
<h4>Error Status Codes</h4>
|
||||
<h4>Response Messages</h4>
|
||||
<table class='fullwidth'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>HTTP Status Code</th>
|
||||
<th>Reason</th>
|
||||
<th>Response Model</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="operation-status">
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<td class='code'>{{name}}</td>
|
||||
<td>
|
||||
<select {{#if allowMultiple}} multiple='multiple'{{/if}} class='parameter' name='{{name}}'>
|
||||
<select {{#isArray this}} multiple='multiple'{{/isArray}} class='parameter' name='{{name}}'>
|
||||
{{#if required}}
|
||||
{{else}}
|
||||
{{#if defaultValue}}
|
||||
{{else}}
|
||||
{{#if allowMultiple}}
|
||||
{{else}}
|
||||
{{#isArray this}}
|
||||
{{else}}
|
||||
<option selected="" value=''></option>
|
||||
{{/if}}
|
||||
{{/isArray}}
|
||||
{{/if}}
|
||||
{{/if}}
|
||||
{{#each allowableValues.descriptiveValues}}
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<div class='heading'>
|
||||
<h2>
|
||||
<a href='#!/{{name}}' onclick="Docs.toggleEndpointListForResource('{{name}}');">{{name}}</a> {{#description}} : {{/description}}{{{description}}}
|
||||
<a href='#!/{{id}}' onclick="Docs.toggleEndpointListForResource('{{id}}');">{{name}}</a> {{#description}} : {{/description}}{{{description}}}
|
||||
</h2>
|
||||
<ul class='options'>
|
||||
<li>
|
||||
<a href='#!/{{name}}' id='endpointListTogger_{{name}}'
|
||||
onclick="Docs.toggleEndpointListForResource('{{name}}');">Show/Hide</a>
|
||||
<a href='#!/{{id}}' id='endpointListTogger_{{id}}'
|
||||
onclick="Docs.toggleEndpointListForResource('{{id}}');">Show/Hide</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='#' onclick="Docs.collapseOperationsForResource('{{name}}'); return false;">
|
||||
<a href='#' onclick="Docs.collapseOperationsForResource('{{id}}'); return false;">
|
||||
List Operations
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='#' onclick="Docs.expandOperationsForResource('{{name}}'); return false;">
|
||||
<a href='#' onclick="Docs.expandOperationsForResource('{{id}}'); return false;">
|
||||
Expand Operations
|
||||
</a>
|
||||
</li>
|
||||
@@ -22,6 +22,6 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<ul class='endpoints' id='{{name}}_endpoint_list' style='display:none'>
|
||||
<ul class='endpoints' id='{{id}}_endpoint_list' style='display:none'>
|
||||
|
||||
</ul>
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
<td width='15%' class='code'>{{code}}</td>
|
||||
<td>{{{message}}}</td>
|
||||
<td width='50%'><span class="model-signature" /></td>
|
||||
Reference in New Issue
Block a user