fixed #340 with empty body, updated swagger-js
This commit is contained in:
8
dist/index.html
vendored
8
dist/index.html
vendored
@@ -2,7 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Swagger UI</title>
|
<title>Swagger UI</title>
|
||||||
<link href='https://fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
<link href='//fonts.googleapis.com/css?family=Droid+Sans:400,700' rel='stylesheet' type='text/css'/>
|
||||||
<link href='css/reset.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/screen.css' media='screen' rel='stylesheet' type='text/css'/>
|
||||||
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
|
<link href='css/reset.css' media='print' rel='stylesheet' type='text/css'/>
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(function () {
|
$(function () {
|
||||||
window.swaggerUi = new SwaggerUi({
|
window.swaggerUi = new SwaggerUi({
|
||||||
url: "http://localhost:8002/api/api-docs",
|
url: "http://petstore.swagger.wordnik.com/api/api-docs",
|
||||||
dom_id: "swagger-ui-container",
|
dom_id: "swagger-ui-container",
|
||||||
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
supportedSubmitMethods: ['get', 'post', 'put', 'delete'],
|
||||||
onComplete: function(swaggerApi, swaggerUi){
|
onComplete: function(swaggerApi, swaggerUi){
|
||||||
@@ -55,11 +55,9 @@
|
|||||||
log("key: " + key);
|
log("key: " + key);
|
||||||
if(key && key.trim() != "") {
|
if(key && key.trim() != "") {
|
||||||
log("added key " + key);
|
log("added key " + key);
|
||||||
window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "header"));
|
window.authorizations.add("key", new ApiKeyAuthorization("api_key", key, "query"));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
window.authorizations.add("key1", new ApiKeyAuthorization("key1", "the_key_1", "header"));
|
|
||||||
window.authorizations.add("key2", new ApiKeyAuthorization("key2", "the_key_2", "header"));
|
|
||||||
window.swaggerUi.load();
|
window.swaggerUi.load();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
4
dist/lib/shred.bundle.js
vendored
4
dist/lib/shred.bundle.js
vendored
@@ -2131,12 +2131,10 @@ require.define("/shred/mixins/headers.js", function (require, module, exports, _
|
|||||||
// to `Content-Type`.
|
// to `Content-Type`.
|
||||||
|
|
||||||
var corsetCase = function(string) {
|
var corsetCase = function(string) {
|
||||||
return string;
|
return string.toLowerCase()
|
||||||
/* return string.toLowerCase()
|
|
||||||
//.replace("_","-")
|
//.replace("_","-")
|
||||||
.replace(/(^|-)(\w)/g,
|
.replace(/(^|-)(\w)/g,
|
||||||
function(s) { return s.toUpperCase(); });
|
function(s) { return s.toUpperCase(); });
|
||||||
*/
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// We suspect that `initializeHeaders` was once more complicated ...
|
// We suspect that `initializeHeaders` was once more complicated ...
|
||||||
|
|||||||
21
dist/lib/swagger-oauth.js
vendored
21
dist/lib/swagger-oauth.js
vendored
@@ -48,7 +48,7 @@ function handleLogin() {
|
|||||||
str += '</label></li>';
|
str += '</label></li>';
|
||||||
popup.append(str);
|
popup.append(str);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var $win = $(window),
|
var $win = $(window),
|
||||||
dw = $win.width(),
|
dw = $win.width(),
|
||||||
@@ -73,8 +73,9 @@ function handleLogin() {
|
|||||||
popupDialog.hide();
|
popupDialog.hide();
|
||||||
|
|
||||||
var authSchemes = window.swaggerUi.api.authSchemes;
|
var authSchemes = window.swaggerUi.api.authSchemes;
|
||||||
var host = window.location;
|
var location = window.location;
|
||||||
var redirectUrl = host.protocol + '//' + host.host + "/o2c.html";
|
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 url = null;
|
||||||
|
|
||||||
var p = window.swaggerUi.api.authSchemes;
|
var p = window.swaggerUi.api.authSchemes;
|
||||||
@@ -90,23 +91,29 @@ function handleLogin() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var scopes = []
|
var scopes = [];
|
||||||
|
var scopeForUrl='';
|
||||||
var o = $('.api-popup-scopes').find('input:checked');
|
var o = $('.api-popup-scopes').find('input:checked');
|
||||||
|
|
||||||
for(k =0; k < o.length; k++) {
|
for(var k =0; k < o.length; k++) {
|
||||||
scopes.push($(o[k]).attr("scope"));
|
scopes.push($(o[k]).attr("scope"));
|
||||||
|
if(k > 0){
|
||||||
|
scopeForUrl+=' ';
|
||||||
|
}
|
||||||
|
scopeForUrl+=$(o[k]).attr("scope");
|
||||||
}
|
}
|
||||||
|
|
||||||
window.enabledScopes=scopes;
|
window.enabledScopes=scopes;
|
||||||
|
|
||||||
|
|
||||||
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
|
url += '&redirect_uri=' + encodeURIComponent(redirectUrl);
|
||||||
url += '&realm=' + encodeURIComponent(realm);
|
url += '&realm=' + encodeURIComponent(realm);
|
||||||
url += '&client_id=' + encodeURIComponent(clientId);
|
url += '&client_id=' + encodeURIComponent(clientId);
|
||||||
url += '&scope=' + encodeURIComponent(scopes);
|
url += '&scope=' + encodeURIComponent(scopeForUrl);
|
||||||
|
|
||||||
window.open(url);
|
window.open(url);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
popupMask.show();
|
popupMask.show();
|
||||||
popupDialog.show();
|
popupDialog.show();
|
||||||
return;
|
return;
|
||||||
|
|||||||
75
dist/lib/swagger.js
vendored
75
dist/lib/swagger.js
vendored
@@ -1,5 +1,5 @@
|
|||||||
// swagger.js
|
// swagger.js
|
||||||
// version 2.0.30
|
// version 2.0.31
|
||||||
|
|
||||||
var __bind = function(fn, me){
|
var __bind = function(fn, me){
|
||||||
return function(){
|
return function(){
|
||||||
@@ -87,6 +87,7 @@ var SwaggerApi = function(url, options) {
|
|||||||
this.authorizations = null;
|
this.authorizations = null;
|
||||||
this.authorizationScheme = null;
|
this.authorizationScheme = null;
|
||||||
this.info = null;
|
this.info = null;
|
||||||
|
this.useJQuery = false;
|
||||||
|
|
||||||
options = (options||{});
|
options = (options||{});
|
||||||
if (url)
|
if (url)
|
||||||
@@ -103,6 +104,9 @@ var SwaggerApi = function(url, options) {
|
|||||||
if (options.success != null)
|
if (options.success != null)
|
||||||
this.success = options.success;
|
this.success = options.success;
|
||||||
|
|
||||||
|
if (typeof options.useJQuery === 'boolean')
|
||||||
|
this.useJQuery = options.useJQuery;
|
||||||
|
|
||||||
this.failure = options.failure != null ? options.failure : function() {};
|
this.failure = options.failure != null ? options.failure : function() {};
|
||||||
this.progress = options.progress != null ? options.progress : function() {};
|
this.progress = options.progress != null ? options.progress : function() {};
|
||||||
if (options.success != null)
|
if (options.success != null)
|
||||||
@@ -432,7 +436,6 @@ SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes,
|
|||||||
output = [];
|
output = [];
|
||||||
for (var i = 0; i < ops.length; i++) {
|
for (var i = 0; i < ops.length; i++) {
|
||||||
o = ops[i];
|
o = ops[i];
|
||||||
|
|
||||||
consumes = this.consumes;
|
consumes = this.consumes;
|
||||||
produces = this.produces;
|
produces = this.produces;
|
||||||
if (o.consumes != null)
|
if (o.consumes != null)
|
||||||
@@ -479,8 +482,7 @@ SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes,
|
|||||||
|
|
||||||
SwaggerResource.prototype.sanitize = function(nickname) {
|
SwaggerResource.prototype.sanitize = function(nickname) {
|
||||||
var op;
|
var op;
|
||||||
op = nickname.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|./?,\\'""-]/g, '_');
|
op = nickname.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_');
|
||||||
//'
|
|
||||||
op = op.replace(/((_){2,})/g, '_');
|
op = op.replace(/((_){2,})/g, '_');
|
||||||
op = op.replace(/^(_)*/g, '');
|
op = op.replace(/^(_)*/g, '');
|
||||||
op = op.replace(/([_])*$/g, '');
|
op = op.replace(/([_])*$/g, '');
|
||||||
@@ -675,7 +677,6 @@ var SwaggerOperation = function(nickname, path, method, parameters, summary, not
|
|||||||
this.resource = (resource||errors.push("Resource is required"));
|
this.resource = (resource||errors.push("Resource is required"));
|
||||||
this.consumes = consumes;
|
this.consumes = consumes;
|
||||||
this.produces = produces;
|
this.produces = produces;
|
||||||
|
|
||||||
this.authorizations = authorizations;
|
this.authorizations = authorizations;
|
||||||
this["do"] = __bind(this["do"], this);
|
this["do"] = __bind(this["do"], this);
|
||||||
|
|
||||||
@@ -1075,7 +1076,7 @@ SwaggerOperation.prototype.formatXml = function(xml) {
|
|||||||
var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
|
var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
var errors = [];
|
var errors = [];
|
||||||
this.useJQuery = (typeof operation.useJQuery !== 'undefined' ? operation.useJQuery : null);
|
this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null);
|
||||||
this.type = (type||errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."));
|
this.type = (type||errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."));
|
||||||
this.url = (url||errors.push("SwaggerRequest url is required."));
|
this.url = (url||errors.push("SwaggerRequest url is required."));
|
||||||
this.params = params;
|
this.params = params;
|
||||||
@@ -1123,6 +1124,8 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
|||||||
else
|
else
|
||||||
requestContentType = "application/x-www-form-urlencoded";
|
requestContentType = "application/x-www-form-urlencoded";
|
||||||
}
|
}
|
||||||
|
else if (this.type == "DELETE")
|
||||||
|
body = "{}";
|
||||||
else if (this.type != "DELETE")
|
else if (this.type != "DELETE")
|
||||||
requestContentType = null;
|
requestContentType = null;
|
||||||
}
|
}
|
||||||
@@ -1205,7 +1208,7 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
|||||||
} else {
|
} else {
|
||||||
e = exports;
|
e = exports;
|
||||||
}
|
}
|
||||||
status = e.authorizations.apply(obj, this.operation);
|
status = e.authorizations.apply(obj, this.operation.authorizations);
|
||||||
if (opts.mock == null) {
|
if (opts.mock == null) {
|
||||||
if (status !== false) {
|
if (status !== false) {
|
||||||
new SwaggerHttp().execute(obj);
|
new SwaggerHttp().execute(obj);
|
||||||
@@ -1261,9 +1264,16 @@ SwaggerHttp.prototype.isIE8 = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic
|
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic.
|
||||||
|
* NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space.
|
||||||
|
* Since we are using closures here we need to alias it for internal use.
|
||||||
*/
|
*/
|
||||||
var JQueryHttpClient = function(options) {}
|
var JQueryHttpClient = function(options) {
|
||||||
|
"use strict";
|
||||||
|
if(!jQuery){
|
||||||
|
var jQuery = window.jQuery;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
JQueryHttpClient.prototype.execute = function(obj) {
|
JQueryHttpClient.prototype.execute = function(obj) {
|
||||||
var cb = obj.on;
|
var cb = obj.on;
|
||||||
@@ -1337,8 +1347,8 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
|||||||
return cb.response(out);
|
return cb.response(out);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.support.cors = true;
|
jQuery.support.cors = true;
|
||||||
return $.ajax(obj);
|
return jQuery.ajax(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1453,33 +1463,32 @@ SwaggerAuthorizations.prototype.remove = function(name) {
|
|||||||
return delete this.authz[name];
|
return delete this.authz[name];
|
||||||
};
|
};
|
||||||
|
|
||||||
SwaggerAuthorizations.prototype.apply = function(obj, operation) {
|
SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
|
||||||
status = null;
|
var status = null;
|
||||||
var key;
|
var key;
|
||||||
for (key in this.authz) {
|
|
||||||
var authorizations = (operation||{}).authorizations
|
|
||||||
var applyAuth = false;
|
|
||||||
if(operation) {
|
|
||||||
if(!operation.authorizations)
|
|
||||||
applyAuth = true;
|
|
||||||
else if(typeof authorizations[key] !== 'undefined')
|
|
||||||
applyAuth = true;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
applyAuth = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(typeof authorizations === 'undefined') {
|
||||||
|
// apply all keys since no authorizations hash is defined
|
||||||
|
for (key in this.authz) {
|
||||||
value = this.authz[key];
|
value = this.authz[key];
|
||||||
if(applyAuth) {
|
|
||||||
console.log('applying auth ' + key);
|
|
||||||
result = value.apply(obj, authorizations);
|
result = value.apply(obj, authorizations);
|
||||||
if (result === false)
|
|
||||||
status = false;
|
|
||||||
if (result === true)
|
if (result === true)
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
else status = false;
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
for(name in authorizations) {
|
||||||
|
for (key in this.authz) {
|
||||||
|
if(key == name) {
|
||||||
|
value = this.authz[key];
|
||||||
|
result = value.apply(obj, authorizations);
|
||||||
|
if (result === true)
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1492,7 +1501,7 @@ var ApiKeyAuthorization = function(name, value, type) {
|
|||||||
this.type = type;
|
this.type = type;
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiKeyAuthorization.prototype.apply = function(obj, operation) {
|
ApiKeyAuthorization.prototype.apply = function(obj, authorizations) {
|
||||||
if (this.type === "query") {
|
if (this.type === "query") {
|
||||||
if (obj.url.indexOf('?') > 0)
|
if (obj.url.indexOf('?') > 0)
|
||||||
obj.url = obj.url + "&" + this.name + "=" + this.value;
|
obj.url = obj.url + "&" + this.name + "=" + this.value;
|
||||||
@@ -1509,7 +1518,7 @@ var CookieAuthorization = function(cookie) {
|
|||||||
this.cookie = cookie;
|
this.cookie = cookie;
|
||||||
}
|
}
|
||||||
|
|
||||||
CookieAuthorization.prototype.apply = function(obj, operation) {
|
CookieAuthorization.prototype.apply = function(obj, authorizations) {
|
||||||
obj.cookieJar = obj.cookieJar || CookieJar();
|
obj.cookieJar = obj.cookieJar || CookieJar();
|
||||||
obj.cookieJar.setCookie(this.cookie);
|
obj.cookieJar.setCookie(this.cookie);
|
||||||
return true;
|
return true;
|
||||||
@@ -1529,7 +1538,7 @@ var PasswordAuthorization = function(name, username, password) {
|
|||||||
this._btoa = require("btoa");
|
this._btoa = require("btoa");
|
||||||
};
|
};
|
||||||
|
|
||||||
PasswordAuthorization.prototype.apply = function(obj, operation) {
|
PasswordAuthorization.prototype.apply = function(obj, authorizations) {
|
||||||
var base64encoder = this._btoa;
|
var base64encoder = this._btoa;
|
||||||
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
|
obj.headers["Authorization"] = "Basic " + base64encoder(this.username + ":" + this.password);
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
38
dist/lib/underscore-min.js
vendored
38
dist/lib/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
|||||||
// swagger.js
|
// swagger.js
|
||||||
// version 2.0.30
|
// version 2.0.31
|
||||||
|
|
||||||
var __bind = function(fn, me){
|
var __bind = function(fn, me){
|
||||||
return function(){
|
return function(){
|
||||||
@@ -87,6 +87,7 @@ var SwaggerApi = function(url, options) {
|
|||||||
this.authorizations = null;
|
this.authorizations = null;
|
||||||
this.authorizationScheme = null;
|
this.authorizationScheme = null;
|
||||||
this.info = null;
|
this.info = null;
|
||||||
|
this.useJQuery = false;
|
||||||
|
|
||||||
options = (options||{});
|
options = (options||{});
|
||||||
if (url)
|
if (url)
|
||||||
@@ -103,6 +104,9 @@ var SwaggerApi = function(url, options) {
|
|||||||
if (options.success != null)
|
if (options.success != null)
|
||||||
this.success = options.success;
|
this.success = options.success;
|
||||||
|
|
||||||
|
if (typeof options.useJQuery === 'boolean')
|
||||||
|
this.useJQuery = options.useJQuery;
|
||||||
|
|
||||||
this.failure = options.failure != null ? options.failure : function() {};
|
this.failure = options.failure != null ? options.failure : function() {};
|
||||||
this.progress = options.progress != null ? options.progress : function() {};
|
this.progress = options.progress != null ? options.progress : function() {};
|
||||||
if (options.success != null)
|
if (options.success != null)
|
||||||
@@ -478,8 +482,7 @@ SwaggerResource.prototype.addOperations = function(resource_path, ops, consumes,
|
|||||||
|
|
||||||
SwaggerResource.prototype.sanitize = function(nickname) {
|
SwaggerResource.prototype.sanitize = function(nickname) {
|
||||||
var op;
|
var op;
|
||||||
op = nickname.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|./?,\\'""-]/g, '_');
|
op = nickname.replace(/[\s!@#$%^&*()_+=\[{\]};:<>|.\/?,\\'""-]/g, '_');
|
||||||
//'
|
|
||||||
op = op.replace(/((_){2,})/g, '_');
|
op = op.replace(/((_){2,})/g, '_');
|
||||||
op = op.replace(/^(_)*/g, '');
|
op = op.replace(/^(_)*/g, '');
|
||||||
op = op.replace(/([_])*$/g, '');
|
op = op.replace(/([_])*$/g, '');
|
||||||
@@ -1073,7 +1076,7 @@ SwaggerOperation.prototype.formatXml = function(xml) {
|
|||||||
var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
|
var SwaggerRequest = function(type, url, params, opts, successCallback, errorCallback, operation, execution) {
|
||||||
var _this = this;
|
var _this = this;
|
||||||
var errors = [];
|
var errors = [];
|
||||||
this.useJQuery = (typeof operation.useJQuery !== 'undefined' ? operation.useJQuery : null);
|
this.useJQuery = (typeof operation.resource.useJQuery !== 'undefined' ? operation.resource.useJQuery : null);
|
||||||
this.type = (type||errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."));
|
this.type = (type||errors.push("SwaggerRequest type is required (get/post/put/delete/patch/options)."));
|
||||||
this.url = (url||errors.push("SwaggerRequest url is required."));
|
this.url = (url||errors.push("SwaggerRequest url is required."));
|
||||||
this.params = params;
|
this.params = params;
|
||||||
@@ -1121,6 +1124,8 @@ var SwaggerRequest = function(type, url, params, opts, successCallback, errorCal
|
|||||||
else
|
else
|
||||||
requestContentType = "application/x-www-form-urlencoded";
|
requestContentType = "application/x-www-form-urlencoded";
|
||||||
}
|
}
|
||||||
|
else if (this.type == "DELETE")
|
||||||
|
body = "{}";
|
||||||
else if (this.type != "DELETE")
|
else if (this.type != "DELETE")
|
||||||
requestContentType = null;
|
requestContentType = null;
|
||||||
}
|
}
|
||||||
@@ -1259,9 +1264,16 @@ SwaggerHttp.prototype.isIE8 = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic
|
* JQueryHttpClient lets a browser take advantage of JQuery's cross-browser magic.
|
||||||
|
* NOTE: when jQuery is available it will export both '$' and 'jQuery' to the global space.
|
||||||
|
* Since we are using closures here we need to alias it for internal use.
|
||||||
*/
|
*/
|
||||||
var JQueryHttpClient = function(options) {}
|
var JQueryHttpClient = function(options) {
|
||||||
|
"use strict";
|
||||||
|
if(!jQuery){
|
||||||
|
var jQuery = window.jQuery;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
JQueryHttpClient.prototype.execute = function(obj) {
|
JQueryHttpClient.prototype.execute = function(obj) {
|
||||||
var cb = obj.on;
|
var cb = obj.on;
|
||||||
@@ -1335,8 +1347,8 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
|||||||
return cb.response(out);
|
return cb.response(out);
|
||||||
};
|
};
|
||||||
|
|
||||||
$.support.cors = true;
|
jQuery.support.cors = true;
|
||||||
return $.ajax(obj);
|
return jQuery.ajax(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1452,16 +1464,31 @@ SwaggerAuthorizations.prototype.remove = function(name) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
|
SwaggerAuthorizations.prototype.apply = function(obj, authorizations) {
|
||||||
status = null;
|
var status = null;
|
||||||
var key;
|
var key;
|
||||||
|
|
||||||
|
if(typeof authorizations === 'undefined') {
|
||||||
|
// apply all keys since no authorizations hash is defined
|
||||||
for (key in this.authz) {
|
for (key in this.authz) {
|
||||||
value = this.authz[key];
|
value = this.authz[key];
|
||||||
result = value.apply(obj, authorizations);
|
result = value.apply(obj, authorizations);
|
||||||
if (result === false)
|
|
||||||
status = false;
|
|
||||||
if (result === true)
|
if (result === true)
|
||||||
status = true;
|
status = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for(name in authorizations) {
|
||||||
|
for (key in this.authz) {
|
||||||
|
if(key == name) {
|
||||||
|
value = this.authz[key];
|
||||||
|
result = value.apply(obj, authorizations);
|
||||||
|
if (result === true)
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user