Upgraded to latest Swagger-UI for 1.2 support
This commit is contained in:
parent
a9c1152c74
commit
5a07b80b6b
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="WEB_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
|
@ -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;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,10 +1,13 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>StrongLoop API Explorer</title>
|
||||
<title>Swagger UI</title>
|
||||
<link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/hightlight.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'/>
|
||||
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
|
||||
<link href='css/screen.css' media='print' 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>
|
||||
<script src='lib/jquery.slideto.min.js' type='text/javascript'></script>
|
||||
<script src='lib/jquery.wiggle.min.js' type='text/javascript'></script>
|
||||
|
@ -16,67 +19,69 @@
|
|||
<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 () {
|
||||
$.getJSON('config.json', function(config) {
|
||||
console.log(config);
|
||||
loadSwaggerUi(config);
|
||||
});
|
||||
});
|
||||
|
||||
function loadSwaggerUi(config) {
|
||||
window.swaggerUi = new SwaggerUi({
|
||||
discoveryUrl: config.discoveryUrl || "/swagger/resources",
|
||||
apiKey: "",
|
||||
url: "http://petstore.swagger.wordnik.com/api/api-docs",
|
||||
dom_id: "swagger-ui-container",
|
||||
supportHeaderParams: true,
|
||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||
onComplete: function(swaggerApi, swaggerUi){
|
||||
if (console) {
|
||||
console.log("Loaded SwaggerUI")
|
||||
console.log(swaggerApi);
|
||||
console.log(swaggerUi);
|
||||
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)});
|
||||
$('pre code').each(function(i, e) {
|
||||
hljs.highlightBlock(e)
|
||||
});
|
||||
},
|
||||
onFailure: function(data) {
|
||||
if (console) {
|
||||
console.log("Unable to Load SwaggerUI");
|
||||
console.log(data);
|
||||
}
|
||||
log("Unable to Load SwaggerUI");
|
||||
},
|
||||
docExpansion: "none"
|
||||
});
|
||||
|
||||
window.swaggerUi.load();
|
||||
$('#input_apiKey').change(function() {
|
||||
var key = $('#input_apiKey')[0].value;
|
||||
log("key: " + key);
|
||||
if(key && key.trim() != "") {
|
||||
log("added key " + key);
|
||||
window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
|
||||
}
|
||||
})
|
||||
window.swaggerUi.load();
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<body class="swagger-section">
|
||||
<div id='header'>
|
||||
<div class="swagger-ui-wrap">
|
||||
<a id="logo">StrongLoop API Explorer</a>
|
||||
|
||||
<a id="logo" href="http://swagger.wordnik.com">swagger</a>
|
||||
<form id='api_selector'>
|
||||
<div class='input'>
|
||||
<input placeholder="http://example.com/api"
|
||||
id="input_baseUrl" name="baseUrl"
|
||||
type="text"/>
|
||||
<div class='input icon-btn'>
|
||||
<img id="show-pet-store-icon" src="images/pet_store_api.png" title="Show Swagger Petstore Example Apis">
|
||||
</div>
|
||||
<div class='input icon-btn'>
|
||||
<img id="show-wordnik-dev-icon" src="images/wordnik_api.png" title="Show Wordnik Developer Apis">
|
||||
</div>
|
||||
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
|
||||
<div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
|
||||
<div class='input'><a id="explore" href="#">Explore</a></div>
|
||||
</form>
|
||||
</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>
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,193 @@
|
|||
|
||||
// The purpose of the `Content` object is to abstract away the data conversions
|
||||
// to and from raw content entities as strings. For example, you want to be able
|
||||
// to pass in a Javascript object and have it be automatically converted into a
|
||||
// JSON string if the `content-type` is set to a JSON-based media type.
|
||||
// Conversely, you want to be able to transparently get back a Javascript object
|
||||
// in the response if the `content-type` is a JSON-based media-type.
|
||||
|
||||
// One limitation of the current implementation is that it [assumes the `charset` is UTF-8](https://github.com/spire-io/shred/issues/5).
|
||||
|
||||
// The `Content` constructor takes an options object, which *must* have either a
|
||||
// `body` or `data` property and *may* have a `type` property indicating the
|
||||
// media type. If there is no `type` attribute, a default will be inferred.
|
||||
var Content = function(options) {
|
||||
this.body = options.body;
|
||||
this.data = options.data;
|
||||
this.type = options.type;
|
||||
};
|
||||
|
||||
Content.prototype = {
|
||||
// Treat `toString()` as asking for the `content.body`. That is, the raw content entity.
|
||||
//
|
||||
// toString: function() { return this.body; }
|
||||
//
|
||||
// Commented out, but I've forgotten why. :/
|
||||
};
|
||||
|
||||
|
||||
// `Content` objects have the following attributes:
|
||||
Object.defineProperties(Content.prototype,{
|
||||
|
||||
// - **type**. Typically accessed as `content.type`, reflects the `content-type`
|
||||
// header associated with the request or response. If not passed as an options
|
||||
// to the constructor or set explicitly, it will infer the type the `data`
|
||||
// attribute, if possible, and, failing that, will default to `text/plain`.
|
||||
type: {
|
||||
get: function() {
|
||||
if (this._type) {
|
||||
return this._type;
|
||||
} else {
|
||||
if (this._data) {
|
||||
switch(typeof this._data) {
|
||||
case "string": return "text/plain";
|
||||
case "object": return "application/json";
|
||||
}
|
||||
}
|
||||
}
|
||||
return "text/plain";
|
||||
},
|
||||
set: function(value) {
|
||||
this._type = value;
|
||||
return this;
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
|
||||
// - **data**. Typically accessed as `content.data`, reflects the content entity
|
||||
// converted into Javascript data. This can be a string, if the `type` is, say,
|
||||
// `text/plain`, but can also be a Javascript object. The conversion applied is
|
||||
// based on the `processor` attribute. The `data` attribute can also be set
|
||||
// directly, in which case the conversion will be done the other way, to infer
|
||||
// the `body` attribute.
|
||||
data: {
|
||||
get: function() {
|
||||
if (this._body) {
|
||||
return this.processor.parser(this._body);
|
||||
} else {
|
||||
return this._data;
|
||||
}
|
||||
},
|
||||
set: function(data) {
|
||||
if (this._body&&data) Errors.setDataWithBody(this);
|
||||
this._data = data;
|
||||
return this;
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
|
||||
// - **body**. Typically accessed as `content.body`, reflects the content entity
|
||||
// as a UTF-8 string. It is the mirror of the `data` attribute. If you set the
|
||||
// `data` attribute, the `body` attribute will be inferred and vice-versa. If
|
||||
// you attempt to set both, an exception is raised.
|
||||
body: {
|
||||
get: function() {
|
||||
if (this._data) {
|
||||
return this.processor.stringify(this._data);
|
||||
} else {
|
||||
return this._body.toString();
|
||||
}
|
||||
},
|
||||
set: function(body) {
|
||||
if (this._data&&body) Errors.setBodyWithData(this);
|
||||
this._body = body;
|
||||
return this;
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
|
||||
// - **processor**. The functions that will be used to convert to/from `data` and
|
||||
// `body` attributes. You can add processors. The two that are built-in are for
|
||||
// `text/plain`, which is basically an identity transformation and
|
||||
// `application/json` and other JSON-based media types (including custom media
|
||||
// types with `+json`). You can add your own processors. See below.
|
||||
processor: {
|
||||
get: function() {
|
||||
var processor = Content.processors[this.type];
|
||||
if (processor) {
|
||||
return processor;
|
||||
} else {
|
||||
// Return the first processor that matches any part of the
|
||||
// content type. ex: application/vnd.foobar.baz+json will match json.
|
||||
var main = this.type.split(";")[0];
|
||||
var parts = main.split(/\+|\//);
|
||||
for (var i=0, l=parts.length; i < l; i++) {
|
||||
processor = Content.processors[parts[i]]
|
||||
}
|
||||
return processor || {parser:identity,stringify:toString};
|
||||
}
|
||||
},
|
||||
enumerable: true
|
||||
},
|
||||
|
||||
// - **length**. Typically accessed as `content.length`, returns the length in
|
||||
// bytes of the raw content entity.
|
||||
length: {
|
||||
get: function() {
|
||||
if (typeof Buffer !== 'undefined') {
|
||||
return Buffer.byteLength(this.body);
|
||||
}
|
||||
return this.body.length;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Content.processors = {};
|
||||
|
||||
// The `registerProcessor` function allows you to add your own processors to
|
||||
// convert content entities. Each processor consists of a Javascript object with
|
||||
// two properties:
|
||||
// - **parser**. The function used to parse a raw content entity and convert it
|
||||
// into a Javascript data type.
|
||||
// - **stringify**. The function used to convert a Javascript data type into a
|
||||
// raw content entity.
|
||||
Content.registerProcessor = function(types,processor) {
|
||||
|
||||
// You can pass an array of types that will trigger this processor, or just one.
|
||||
// We determine the array via duck-typing here.
|
||||
if (types.forEach) {
|
||||
types.forEach(function(type) {
|
||||
Content.processors[type] = processor;
|
||||
});
|
||||
} else {
|
||||
// If you didn't pass an array, we just use what you pass in.
|
||||
Content.processors[types] = processor;
|
||||
}
|
||||
};
|
||||
|
||||
// Register the identity processor, which is used for text-based media types.
|
||||
var identity = function(x) { return x; }
|
||||
, toString = function(x) { return x.toString(); }
|
||||
Content.registerProcessor(
|
||||
["text/html","text/plain","text"],
|
||||
{ parser: identity, stringify: toString });
|
||||
|
||||
// Register the JSON processor, which is used for JSON-based media types.
|
||||
Content.registerProcessor(
|
||||
["application/json; charset=utf-8","application/json","json"],
|
||||
{
|
||||
parser: function(string) {
|
||||
return JSON.parse(string);
|
||||
},
|
||||
stringify: function(data) {
|
||||
return JSON.stringify(data); }});
|
||||
|
||||
var qs = require('querystring');
|
||||
// Register the post processor, which is used for JSON-based media types.
|
||||
Content.registerProcessor(
|
||||
["application/x-www-form-urlencoded"],
|
||||
{ parser : qs.parse, stringify : qs.stringify });
|
||||
|
||||
// Error functions are defined separately here in an attempt to make the code
|
||||
// easier to read.
|
||||
var Errors = {
|
||||
setDataWithBody: function(object) {
|
||||
throw new Error("Attempt to set data attribute of a content object " +
|
||||
"when the body attributes was already set.");
|
||||
},
|
||||
setBodyWithData: function(object) {
|
||||
throw new Error("Attempt to set body attribute of a content object " +
|
||||
"when the data attributes was already set.");
|
||||
}
|
||||
}
|
||||
module.exports = Content;
|
|
@ -0,0 +1,218 @@
|
|||
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 location = window.location;
|
||||
var locationUrl = location.protocol + '//' + location.host + location.pathname;
|
||||
var redirectUrl = locationUrl.replace("index.html","").concat("/o2c.html").replace("//o2c.html","/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 scopeForUrl='';
|
||||
var o = $('.api-popup-scopes').find('input:checked');
|
||||
|
||||
for(var k =0; k < o.length; k++) {
|
||||
scopes.push($(o[k]).attr("scope"));
|
||||
if(k > 0){
|
||||
scopeForUrl+=' ';
|
||||
}
|
||||
scopeForUrl+=$(o[k]).attr("scope");
|
||||
}
|
||||
|
||||
window.enabledScopes=scopes;
|
||||
|
||||
|
||||
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
|
||||
url += '&realm=' + encodeURIComponent(realm);
|
||||
url += '&client_id=' + encodeURIComponent(clientId);
|
||||
url += '&scope=' + encodeURIComponent(scopeForUrl);
|
||||
|
||||
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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -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>
|
1102
public/swagger-ui.js
1102
public/swagger-ui.js
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue