Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7430c3132 | ||
|
|
da2008d605 | ||
|
|
3ecc974ee4 | ||
|
|
24b649f2d5 | ||
|
|
65034e0876 | ||
|
|
8f99335737 | ||
|
|
b3c31eb631 | ||
|
|
048c5dd98f | ||
|
|
1447b865d2 | ||
|
|
75bb7e2521 | ||
|
|
fb30579387 | ||
|
|
fbd7f83e5b |
@@ -91,6 +91,7 @@ sorter | Apply a sort to the API list. It can be 'alpha' (sort paths alphanumeri
|
||||
onComplete | This is a callback function parameter which can be passed to be notified of when SwaggerUI has completed rendering successfully.
|
||||
onFailure | This is a callback function parameter which can be passed to be notified of when SwaggerUI encountered a failure was unable to render.
|
||||
highlightSizeThreshold | Any size response below this threshold will be highlighted syntactically, attempting to highlight large responses can lead to browser hangs, not including a threshold will default to highlight all returned responses.
|
||||
supportedSubmitMethods | An array of of the HTTP operations that will have the 'Try it out!` option. An empty array disables all operations. This does not filter the operations from the display.
|
||||
|
||||
* All other parameters are explained in greater detail below
|
||||
|
||||
|
||||
Vendored
+129
-50
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* swagger-client - swagger.js is a javascript client for use with swaggering APIs.
|
||||
* @version v2.1.5-M1
|
||||
* @version v2.1.8-M1
|
||||
* @link http://swagger.io
|
||||
* @license apache 2.0
|
||||
*/
|
||||
@@ -346,8 +346,7 @@ SwaggerClient.prototype.initialize = function (url, options) {
|
||||
if (options.authorizations) {
|
||||
this.clientAuthorizations = options.authorizations;
|
||||
} else {
|
||||
var e = (typeof window !== 'undefined' ? window : exports);
|
||||
this.clientAuthorizations = e.authorizations;
|
||||
this.clientAuthorizations = authorizations;
|
||||
}
|
||||
|
||||
this.supportedSubmitMethods = options.supportedSubmitMethods || [];
|
||||
@@ -407,8 +406,7 @@ SwaggerClient.prototype.build = function(mock) {
|
||||
setTimeout(function() { self.buildFromSpec(self.spec); }, 10);
|
||||
}
|
||||
else {
|
||||
var e = (typeof window !== 'undefined' ? window : exports);
|
||||
var status = e.authorizations.apply(obj);
|
||||
authorizations.apply(obj);
|
||||
if(mock)
|
||||
return obj;
|
||||
new SwaggerHttp().execute(obj);
|
||||
@@ -502,6 +500,8 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
||||
for(i = 0; i < tags.length; i++) {
|
||||
var tag = this.tagFromLabel(tags[i]);
|
||||
var operationGroup = this[tag];
|
||||
if(typeof this.apis[tag] === 'undefined')
|
||||
this.apis[tag] = {};
|
||||
if(typeof operationGroup === 'undefined') {
|
||||
this[tag] = [];
|
||||
operationGroup = this[tag];
|
||||
@@ -516,8 +516,16 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
||||
this[tag].help = this.help.bind(operationGroup);
|
||||
this.apisArray.push(new OperationGroup(tag, operationGroup.description, operationGroup.externalDocs, operationObject));
|
||||
}
|
||||
if(typeof this.apis[tag].help !== 'function')
|
||||
this.apis[tag].help = this.help.bind(operationGroup);
|
||||
// bind to the apis object
|
||||
this.apis[tag][operationId] = operationObject.execute.bind(operationObject);
|
||||
this.apis[tag][operationId].help = operationObject.help.bind(operationObject);
|
||||
this.apis[tag][operationId].asCurl = operationObject.asCurl.bind(operationObject);
|
||||
operationGroup[operationId] = operationObject.execute.bind(operationObject);
|
||||
operationGroup[operationId].help = operationObject.help.bind(operationObject);
|
||||
operationGroup[operationId].asCurl = operationObject.asCurl.bind(operationObject);
|
||||
|
||||
operationGroup.apis.push(operationObject);
|
||||
operationGroup.operations[operationId] = operationObject;
|
||||
|
||||
@@ -560,12 +568,18 @@ SwaggerClient.prototype.parseUri = function(uri) {
|
||||
};
|
||||
};
|
||||
|
||||
SwaggerClient.prototype.help = function() {
|
||||
SwaggerClient.prototype.help = function(dontPrint) {
|
||||
var i;
|
||||
log('operations for the "' + this.label + '" tag');
|
||||
var output = 'operations for the "' + this.label + '" tag';
|
||||
for(i = 0; i < this.apis.length; i++) {
|
||||
var api = this.apis[i];
|
||||
log(' * ' + api.nickname + ': ' + api.operation.summary);
|
||||
output += '\n * ' + api.nickname + ': ' + api.operation.summary;
|
||||
}
|
||||
if(dontPrint)
|
||||
return output;
|
||||
else {
|
||||
log(output);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -817,7 +831,7 @@ Operation.prototype.help = function(dontPrint) {
|
||||
var out = this.nickname + ': ' + this.summary + '\n';
|
||||
for(var i = 0; i < this.parameters.length; i++) {
|
||||
var param = this.parameters[i];
|
||||
var typeInfo = typeFromJsonSchema(param.type, param.format);
|
||||
var typeInfo = param.signature;
|
||||
out += '\n * ' + param.name + ' (' + typeInfo + '): ' + param.description;
|
||||
}
|
||||
if(typeof dontPrint === 'undefined')
|
||||
@@ -935,9 +949,8 @@ Operation.prototype.getMissingParams = function(args) {
|
||||
return missingParams;
|
||||
};
|
||||
|
||||
Operation.prototype.getBody = function(headers, args) {
|
||||
var formParams = {};
|
||||
var body;
|
||||
Operation.prototype.getBody = function(headers, args, opts) {
|
||||
var formParams = {}, body, key;
|
||||
|
||||
for(var i = 0; i < this.parameters.length; i++) {
|
||||
var param = this.parameters[i];
|
||||
@@ -953,7 +966,6 @@ Operation.prototype.getBody = function(headers, args) {
|
||||
// handle form params
|
||||
if(headers['Content-Type'] === 'application/x-www-form-urlencoded') {
|
||||
var encoded = "";
|
||||
var key;
|
||||
for(key in formParams) {
|
||||
value = formParams[key];
|
||||
if(typeof value !== 'undefined'){
|
||||
@@ -964,6 +976,25 @@ Operation.prototype.getBody = function(headers, args) {
|
||||
}
|
||||
body = encoded;
|
||||
}
|
||||
else if (headers['Content-Type'] && headers['Content-Type'].indexOf('multipart/form-data') >= 0) {
|
||||
if(opts.useJQuery) {
|
||||
var bodyParam = new FormData();
|
||||
bodyParam.type = 'formData';
|
||||
for (key in formParams) {
|
||||
value = args[key];
|
||||
if (typeof value !== 'undefined') {
|
||||
// required for jquery file upload
|
||||
if(value.type === 'file' && value.value) {
|
||||
delete headers['Content-Type'];
|
||||
bodyParam.append(key, value.value);
|
||||
}
|
||||
else
|
||||
bodyParam.append(key, value);
|
||||
}
|
||||
}
|
||||
body = bodyParam;
|
||||
}
|
||||
}
|
||||
|
||||
return body;
|
||||
};
|
||||
@@ -1026,9 +1057,8 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
success = (success||log);
|
||||
error = (error||log);
|
||||
|
||||
if(typeof opts.useJQuery === 'boolean') {
|
||||
if(opts.useJQuery)
|
||||
this.useJQuery = opts.useJQuery;
|
||||
}
|
||||
|
||||
var missingParams = this.getMissingParams(args);
|
||||
if(missingParams.length > 0) {
|
||||
@@ -1043,7 +1073,7 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
for (attrname in allHeaders) { headers[attrname] = allHeaders[attrname]; }
|
||||
for (attrname in contentTypeHeaders) { headers[attrname] = contentTypeHeaders[attrname]; }
|
||||
|
||||
var body = this.getBody(headers, args);
|
||||
var body = this.getBody(headers, args, opts);
|
||||
var url = this.urlify(args);
|
||||
|
||||
var obj = {
|
||||
@@ -1061,7 +1091,7 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
}
|
||||
}
|
||||
};
|
||||
var status = e.authorizations.apply(obj, this.operation.security);
|
||||
var status = authorizations.apply(obj, this.operation.security);
|
||||
if(opts.mock === true)
|
||||
return obj;
|
||||
else
|
||||
@@ -1144,14 +1174,24 @@ Operation.prototype.setContentTypes = function(args, opts) {
|
||||
};
|
||||
|
||||
Operation.prototype.asCurl = function (args) {
|
||||
var obj = this.execute(args, {mock: true});
|
||||
authorizations.apply(obj);
|
||||
var results = [];
|
||||
var headers = this.getHeaderParams(args);
|
||||
if (headers) {
|
||||
results.push('-X ' + this.method.toUpperCase());
|
||||
if (obj.headers) {
|
||||
var key;
|
||||
for (key in headers)
|
||||
results.push("--header \"" + key + ": " + headers[key] + "\"");
|
||||
for (key in obj.headers)
|
||||
results.push('--header "' + key + ': ' + obj.headers[key] + '"');
|
||||
}
|
||||
return "curl " + (results.join(" ")) + " " + this.urlify(args);
|
||||
if(obj.body) {
|
||||
var body;
|
||||
if(typeof obj.body === 'object')
|
||||
body = JSON.stringify(obj.body);
|
||||
else
|
||||
body = obj.body;
|
||||
results.push('-d "' + body.replace(/"/g, '\\"') + '"');
|
||||
}
|
||||
return 'curl ' + (results.join(' ')) + ' "' + obj.url + '"';
|
||||
};
|
||||
|
||||
Operation.prototype.encodePathCollection = function(type, name, value) {
|
||||
@@ -1259,12 +1299,12 @@ var Model = function(name, definition) {
|
||||
};
|
||||
|
||||
Model.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var i, result = {};
|
||||
var i, result = {}, representations = {};
|
||||
modelsToIgnore = (modelsToIgnore||{});
|
||||
modelsToIgnore[this.name] = this;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
prop = this.properties[i];
|
||||
var sample = prop.getSampleValue(modelsToIgnore);
|
||||
var sample = prop.getSampleValue(modelsToIgnore, representations);
|
||||
result[prop.name] = sample;
|
||||
}
|
||||
delete modelsToIgnore[this.name];
|
||||
@@ -1272,10 +1312,10 @@ Model.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
};
|
||||
|
||||
Model.prototype.getSampleValue = function(modelsToIgnore) {
|
||||
var i, obj = {};
|
||||
var i, obj = {}, representations = {};
|
||||
for(i = 0; i < this.properties.length; i++ ) {
|
||||
var property = this.properties[i];
|
||||
obj[property.name] = property.sampleValue(false, modelsToIgnore);
|
||||
obj[property.name] = property.sampleValue(false, modelsToIgnore, representations);
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
@@ -1340,8 +1380,8 @@ var Property = function(name, obj, required) {
|
||||
this.multipleOf = obj.multipleOf || null;
|
||||
};
|
||||
|
||||
Property.prototype.getSampleValue = function (modelsToIgnore) {
|
||||
return this.sampleValue(false, modelsToIgnore);
|
||||
Property.prototype.getSampleValue = function (modelsToIgnore, representations) {
|
||||
return this.sampleValue(false, modelsToIgnore, representations);
|
||||
};
|
||||
|
||||
Property.prototype.isArray = function () {
|
||||
@@ -1352,21 +1392,29 @@ Property.prototype.isArray = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
Property.prototype.sampleValue = function(isArray, ignoredModels) {
|
||||
Property.prototype.sampleValue = function(isArray, ignoredModels, representations) {
|
||||
isArray = (isArray || this.isArray());
|
||||
ignoredModels = (ignoredModels || {});
|
||||
// representations = (representations || {});
|
||||
|
||||
var type = getStringSignature(this.obj, true);
|
||||
var output;
|
||||
|
||||
if(this.$ref) {
|
||||
var refModelName = simpleRef(this.$ref);
|
||||
var refModel = models[refModelName];
|
||||
if(typeof representations[type] !== 'undefined') {
|
||||
return representations[type];
|
||||
}
|
||||
else
|
||||
|
||||
if(refModel && typeof ignoredModels[type] === 'undefined') {
|
||||
ignoredModels[type] = this;
|
||||
output = refModel.getSampleValue(ignoredModels);
|
||||
output = refModel.getSampleValue(ignoredModels, representations);
|
||||
representations[type] = output;
|
||||
}
|
||||
else {
|
||||
output = refModelName;
|
||||
output = (representations[type] || refModelName);
|
||||
}
|
||||
}
|
||||
else if(this.example)
|
||||
@@ -1610,6 +1658,7 @@ SwaggerClient.prototype.buildFrom1_2Spec = function (response) {
|
||||
res = new SwaggerResource(response, this);
|
||||
this.apis[newName] = res;
|
||||
this.apisArray.push(res);
|
||||
this.finish();
|
||||
} else {
|
||||
var k;
|
||||
this.expectedResourceCount = response.apis.length;
|
||||
@@ -1665,7 +1714,9 @@ SwaggerClient.prototype.buildFrom1_1Spec = function (response) {
|
||||
res = new SwaggerResource(response, this);
|
||||
this.apis[newName] = res;
|
||||
this.apisArray.push(res);
|
||||
this.finish();
|
||||
} else {
|
||||
this.expectedResourceCount = response.apis.length;
|
||||
for (k = 0; k < response.apis.length; k++) {
|
||||
resource = response.apis[k];
|
||||
res = new SwaggerResource(resource, this);
|
||||
@@ -1674,9 +1725,6 @@ SwaggerClient.prototype.buildFrom1_1Spec = function (response) {
|
||||
}
|
||||
}
|
||||
this.isValid = true;
|
||||
if (this.success) {
|
||||
this.success();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -1698,16 +1746,18 @@ SwaggerClient.prototype.convertInfo = function (resp) {
|
||||
};
|
||||
|
||||
SwaggerClient.prototype.selfReflect = function () {
|
||||
var resource, resource_name, ref;
|
||||
var resource, tag, ref;
|
||||
if (this.apis === null) {
|
||||
return false;
|
||||
}
|
||||
ref = this.apis;
|
||||
for (resource_name in ref) {
|
||||
resource = ref[resource_name];
|
||||
if (resource.ready === null) {
|
||||
for (tag in ref) {
|
||||
api = ref[tag];
|
||||
if (api.ready === null) {
|
||||
return false;
|
||||
}
|
||||
this[tag] = api;
|
||||
this[tag].help = __bind(api.help, api);
|
||||
}
|
||||
this.setConsolidatedModels();
|
||||
this.ready = true;
|
||||
@@ -1743,7 +1793,6 @@ var SwaggerResource = function (resourceObj, api) {
|
||||
this.description = resourceObj.description;
|
||||
this.authorizations = (resourceObj.authorizations || {});
|
||||
|
||||
|
||||
var parts = this.path.split('/');
|
||||
this.name = parts[parts.length - 1].replace('.{format}', '');
|
||||
this.basePath = this.api.basePath;
|
||||
@@ -1792,6 +1841,21 @@ var SwaggerResource = function (resourceObj, api) {
|
||||
}
|
||||
};
|
||||
|
||||
SwaggerResource.prototype.help = function (dontPrint) {
|
||||
var i;
|
||||
var output = 'operations for the "' + this.name + '" tag';
|
||||
for(i = 0; i < this.operationsArray.length; i++) {
|
||||
var api = this.operationsArray[i];
|
||||
output += '\n * ' + api.nickname + ': ' + api.description;
|
||||
}
|
||||
if(dontPrint)
|
||||
return output;
|
||||
else {
|
||||
log(output);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
SwaggerResource.prototype.getAbsoluteBasePath = function (relativeBasePath) {
|
||||
var pos, url;
|
||||
url = this.api.basePath;
|
||||
@@ -2108,6 +2172,7 @@ var SwaggerOperation = function (nickname, path, method, parameters, summary, no
|
||||
this.deprecated = deprecated;
|
||||
this['do'] = __bind(this['do'], this);
|
||||
|
||||
|
||||
if(typeof this.deprecated === 'string') {
|
||||
switch(this.deprecated.toLowerCase()) {
|
||||
case 'true': case 'yes': case '1': {
|
||||
@@ -2225,8 +2290,8 @@ var SwaggerOperation = function (nickname, path, method, parameters, summary, no
|
||||
return _this['do'](arg1 || {}, arg2 || {}, arg3 || defaultSuccessCallback, arg4 || defaultErrorCallback);
|
||||
};
|
||||
|
||||
this.resource[this.nickname].help = function () {
|
||||
return _this.help();
|
||||
this.resource[this.nickname].help = function (dontPrint) {
|
||||
return _this.help(dontPrint);
|
||||
};
|
||||
this.resource[this.nickname].asCurl = function (args) {
|
||||
return _this.asCurl(args);
|
||||
@@ -2465,16 +2530,19 @@ SwaggerOperation.prototype.getMatchingParams = function (paramTypes, args) {
|
||||
return matchingParams;
|
||||
};
|
||||
|
||||
SwaggerOperation.prototype.help = function () {
|
||||
var msg = '';
|
||||
SwaggerOperation.prototype.help = function (dontPrint) {
|
||||
var msg = this.nickname + ': ' + this.summary;
|
||||
var params = this.parameters;
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var param = params[i];
|
||||
if (msg !== '')
|
||||
msg += '\n';
|
||||
msg += '* ' + param.name + (param.required ? ' (required)' : '') + " - " + param.description;
|
||||
msg += '\n* ' + param.name + (param.required ? ' (required)' : '') + " - " + param.description;
|
||||
}
|
||||
if(dontPrint)
|
||||
return msg;
|
||||
else {
|
||||
console.log(msg);
|
||||
return msg;
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
|
||||
SwaggerOperation.prototype.asCurl = function (args) {
|
||||
@@ -2768,7 +2836,14 @@ SwaggerHttp.prototype.execute = function(obj, opts) {
|
||||
this.useJQuery = this.isIE8();
|
||||
|
||||
if(obj && typeof obj.body === 'object') {
|
||||
obj.body = JSON.stringify(obj.body);
|
||||
if(obj.body.type && obj.body.type !== 'formData')
|
||||
obj.body = JSON.stringify(obj.body);
|
||||
else {
|
||||
obj.contentType = false;
|
||||
obj.processData = false;
|
||||
// delete obj.cache;
|
||||
delete obj.headers['Content-Type'];
|
||||
}
|
||||
}
|
||||
|
||||
if(this.useJQuery)
|
||||
@@ -2809,7 +2884,9 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
|
||||
obj.type = obj.method;
|
||||
obj.cache = false;
|
||||
delete obj.useJQuery;
|
||||
|
||||
/*
|
||||
obj.beforeSend = function(xhr) {
|
||||
var key, results;
|
||||
if (obj.headers) {
|
||||
@@ -2825,9 +2902,10 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
}
|
||||
return results;
|
||||
}
|
||||
};
|
||||
};*/
|
||||
|
||||
obj.data = obj.body;
|
||||
delete obj.body;
|
||||
obj.complete = function(response, textStatus, opts) {
|
||||
var headers = {},
|
||||
headerArray = response.getAllResponseHeaders().split("\n");
|
||||
@@ -2851,6 +2929,7 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
url: request.url,
|
||||
method: request.method,
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
data: response.responseText,
|
||||
headers: headers
|
||||
};
|
||||
@@ -3000,7 +3079,7 @@ ShredHttpClient.prototype.execute = function(obj) {
|
||||
|
||||
var e = (typeof window !== 'undefined' ? window : exports);
|
||||
|
||||
e.authorizations = new SwaggerAuthorizations();
|
||||
e.authorizations = authorizations = new SwaggerAuthorizations();
|
||||
e.ApiKeyAuthorization = ApiKeyAuthorization;
|
||||
e.PasswordAuthorization = PasswordAuthorization;
|
||||
e.CookieAuthorization = CookieAuthorization;
|
||||
|
||||
Vendored
+193
-192
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* swagger-ui - Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API
|
||||
* @version v2.1.5-M1
|
||||
* @version v2.1.6-M1
|
||||
* @link http://swagger.io
|
||||
* @license Apache 2.0
|
||||
*/
|
||||
@@ -475,6 +475,61 @@ this["Handlebars"]["templates"]["content_type"] = Handlebars.template({"1":funct
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</select>\n";
|
||||
},"useData":true});
|
||||
var BasicAuthButton,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
__hasProp = {}.hasOwnProperty;
|
||||
|
||||
BasicAuthButton = (function(_super) {
|
||||
__extends(BasicAuthButton, _super);
|
||||
|
||||
function BasicAuthButton() {
|
||||
return BasicAuthButton.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
BasicAuthButton.prototype.initialize = function() {};
|
||||
|
||||
BasicAuthButton.prototype.render = function() {
|
||||
var template;
|
||||
template = this.template();
|
||||
$(this.el).html(template(this.model));
|
||||
return this;
|
||||
};
|
||||
|
||||
BasicAuthButton.prototype.events = {
|
||||
"click #basic_auth_button": "togglePasswordContainer",
|
||||
"click #apply_basic_auth": "applyPassword"
|
||||
};
|
||||
|
||||
BasicAuthButton.prototype.applyPassword = function() {
|
||||
var elem, password, username;
|
||||
username = $(".input_username").val();
|
||||
password = $(".input_password").val();
|
||||
window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
|
||||
window.swaggerUi.load();
|
||||
return elem = $('#basic_auth_container').hide();
|
||||
};
|
||||
|
||||
BasicAuthButton.prototype.togglePasswordContainer = function() {
|
||||
var elem;
|
||||
if ($('#basic_auth_container').length > 0) {
|
||||
elem = $('#basic_auth_container').show();
|
||||
if (elem.is(':visible')) {
|
||||
return elem.slideUp();
|
||||
} else {
|
||||
$('.auth_container').hide();
|
||||
return elem.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BasicAuthButton.prototype.template = function() {
|
||||
return Handlebars.templates.basic_auth_button_view;
|
||||
};
|
||||
|
||||
return BasicAuthButton;
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var stack1, lambda=this.lambda, escapeExpression=this.escapeExpression, buffer = " <div class=\"info_title\">"
|
||||
+ escapeExpression(lambda(((stack1 = (depth0 != null ? depth0.info : depth0)) != null ? stack1.title : stack1), depth0))
|
||||
@@ -558,58 +613,32 @@ this["Handlebars"]["templates"]["main"] = Handlebars.template({"1":function(dept
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + " </h4>\n </div>\n</div>\n";
|
||||
},"useData":true});
|
||||
var BasicAuthButton,
|
||||
var ContentTypeView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
__hasProp = {}.hasOwnProperty;
|
||||
|
||||
BasicAuthButton = (function(_super) {
|
||||
__extends(BasicAuthButton, _super);
|
||||
ContentTypeView = (function(_super) {
|
||||
__extends(ContentTypeView, _super);
|
||||
|
||||
function BasicAuthButton() {
|
||||
return BasicAuthButton.__super__.constructor.apply(this, arguments);
|
||||
function ContentTypeView() {
|
||||
return ContentTypeView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
BasicAuthButton.prototype.initialize = function() {};
|
||||
ContentTypeView.prototype.initialize = function() {};
|
||||
|
||||
BasicAuthButton.prototype.render = function() {
|
||||
ContentTypeView.prototype.render = function() {
|
||||
var template;
|
||||
template = this.template();
|
||||
$(this.el).html(template(this.model));
|
||||
$('label[for=contentType]', $(this.el)).text('Response Content Type');
|
||||
return this;
|
||||
};
|
||||
|
||||
BasicAuthButton.prototype.events = {
|
||||
"click #basic_auth_button": "togglePasswordContainer",
|
||||
"click #apply_basic_auth": "applyPassword"
|
||||
ContentTypeView.prototype.template = function() {
|
||||
return Handlebars.templates.content_type;
|
||||
};
|
||||
|
||||
BasicAuthButton.prototype.applyPassword = function() {
|
||||
var elem, password, username;
|
||||
username = $(".input_username").val();
|
||||
password = $(".input_password").val();
|
||||
window.authorizations.add(this.model.type, new PasswordAuthorization("basic", username, password));
|
||||
window.swaggerUi.load();
|
||||
return elem = $('#basic_auth_container').hide();
|
||||
};
|
||||
|
||||
BasicAuthButton.prototype.togglePasswordContainer = function() {
|
||||
var elem;
|
||||
if ($('#basic_auth_container').length > 0) {
|
||||
elem = $('#basic_auth_container').show();
|
||||
if (elem.is(':visible')) {
|
||||
return elem.slideUp();
|
||||
} else {
|
||||
$('.auth_container').hide();
|
||||
return elem.show();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
BasicAuthButton.prototype.template = function() {
|
||||
return Handlebars.templates.basic_auth_button_view;
|
||||
};
|
||||
|
||||
return BasicAuthButton;
|
||||
return ContentTypeView;
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
@@ -716,98 +745,6 @@ this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + " </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";
|
||||
},"useData":true});
|
||||
var ContentTypeView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
__hasProp = {}.hasOwnProperty;
|
||||
|
||||
ContentTypeView = (function(_super) {
|
||||
__extends(ContentTypeView, _super);
|
||||
|
||||
function ContentTypeView() {
|
||||
return ContentTypeView.__super__.constructor.apply(this, arguments);
|
||||
}
|
||||
|
||||
ContentTypeView.prototype.initialize = function() {};
|
||||
|
||||
ContentTypeView.prototype.render = function() {
|
||||
var template;
|
||||
template = this.template();
|
||||
$(this.el).html(template(this.model));
|
||||
$('label[for=contentType]', $(this.el)).text('Response Content Type');
|
||||
return this;
|
||||
};
|
||||
|
||||
ContentTypeView.prototype.template = function() {
|
||||
return Handlebars.templates.content_type;
|
||||
};
|
||||
|
||||
return ContentTypeView;
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"2":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <input type=\"file\" name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'/>\n <div class=\"parameter-content-type\" />\n";
|
||||
},"4":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"5":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
|
||||
},"7":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
|
||||
},"9":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"10":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"11":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <input class='parameter' minlength='0' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "' placeholder='' type='text' value='"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "'/>\n";
|
||||
},"13":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <input class='parameter' minlength='0' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "' placeholder='' type='text' value=''/>\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "</td>\n<td>\n\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "\n</td>\n<td class=\"markdown\">";
|
||||
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td>";
|
||||
stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
|
||||
},"useData":true});
|
||||
var HeaderView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
__hasProp = {}.hasOwnProperty;
|
||||
@@ -873,61 +810,68 @@ HeaderView = (function(_super) {
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
return " multiple='multiple'";
|
||||
},"3":function(depth0,helpers,partials,data) {
|
||||
return "";
|
||||
this["Handlebars"]["templates"]["param"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"2":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <input type=\"file\" name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'/>\n <div class=\"parameter-content-type\" />\n";
|
||||
},"4":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(5, data),"inverse":this.program(7, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"5":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"6":function(depth0,helpers,partials,data) {
|
||||
var stack1, helperMissing=helpers.helperMissing, buffer = "";
|
||||
stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "</textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
|
||||
},"7":function(depth0,helpers,partials,data) {
|
||||
return " <option selected=\"\" value=''></option>\n";
|
||||
},"9":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'></textarea>\n <br />\n <div class=\"parameter-content-type\" />\n";
|
||||
},"9":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(10, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"10":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"11":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <option selected=\"\" value='"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ " (default)</option>\n";
|
||||
},"12":function(depth0,helpers,partials,data) {
|
||||
return " <input class='parameter' minlength='0' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "' placeholder='' type='text' value='"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "'/>\n";
|
||||
},"13":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <option value='"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "</option>\n";
|
||||
return " <input class='parameter' minlength='0' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "' placeholder='' type='text' value=''/>\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "</td>\n<td>\n <select ";
|
||||
stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
|
||||
+ "</td>\n<td>\n\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(9, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += " class='parameter' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += " </select>\n</td>\n<td class=\"markdown\">";
|
||||
buffer += "\n</td>\n<td class=\"markdown\">";
|
||||
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td>";
|
||||
stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
|
||||
return buffer + "</td>\n<td>\n <span class=\"model-signature\"></span>\n</td>\n";
|
||||
},"useData":true});
|
||||
var MainView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
@@ -1042,38 +986,61 @@ MainView = (function(_super) {
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' readonly='readonly' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "</textarea>\n";
|
||||
},"3":function(depth0,helpers,partials,data) {
|
||||
this["Handlebars"]["templates"]["param_list"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
return " multiple='multiple'";
|
||||
},"3":function(depth0,helpers,partials,data) {
|
||||
return "";
|
||||
},"5":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(6, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"4":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " "
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "\n";
|
||||
},"6":function(depth0,helpers,partials,data) {
|
||||
return " (empty)\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helperMissing=helpers.helperMissing, buffer = "";
|
||||
stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(3, data),"inverse":this.program(7, data),"data":data}));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"7":function(depth0,helpers,partials,data) {
|
||||
return " <option selected=\"\" value=''></option>\n";
|
||||
},"9":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isDefault : depth0), {"name":"if","hash":{},"fn":this.program(10, data),"inverse":this.program(12, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"10":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <option selected=\"\" value='"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ " (default)</option>\n";
|
||||
},"12":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <option value='"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.value || (depth0 != null ? depth0.value : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"value","hash":{},"data":data}) : helper)))
|
||||
+ "</option>\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "</td>\n<td>\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
|
||||
+ "</td>\n<td>\n <select ";
|
||||
stack1 = ((helpers.isArray || (depth0 && depth0.isArray) || helperMissing).call(depth0, depth0, {"name":"isArray","hash":{},"fn":this.program(1, data),"inverse":this.noop,"data":data}));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td class=\"markdown\">";
|
||||
buffer += " class='parameter' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.required : depth0), {"name":"if","hash":{},"fn":this.program(3, data),"inverse":this.program(5, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
stack1 = helpers.each.call(depth0, ((stack1 = (depth0 != null ? depth0.allowableValues : depth0)) != null ? stack1.descriptiveValues : stack1), {"name":"each","hash":{},"fn":this.program(9, data),"inverse":this.noop,"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += " </select>\n</td>\n<td class=\"markdown\">";
|
||||
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td>";
|
||||
stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
|
||||
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>";
|
||||
},"useData":true});
|
||||
var OperationView,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
@@ -1365,6 +1332,7 @@ OperationView = (function(_super) {
|
||||
map[o.name] = o.value;
|
||||
}
|
||||
if (o.type === "file") {
|
||||
map[o.name] = o.files[0];
|
||||
isFileUpload = true;
|
||||
}
|
||||
}
|
||||
@@ -1412,7 +1380,7 @@ OperationView = (function(_super) {
|
||||
_ref1 = this.model.parameters;
|
||||
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
|
||||
param = _ref1[_j];
|
||||
if (param.paramType === 'form') {
|
||||
if (param.paramType === 'form' || param["in"] === 'formData') {
|
||||
if (param.type.toLowerCase() !== 'file' && map[param.name] !== void 0) {
|
||||
bodyParam.append(param.name, map[param.name]);
|
||||
}
|
||||
@@ -1688,9 +1656,9 @@ OperationView = (function(_super) {
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
this["Handlebars"]["templates"]["param_readonly"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
|
||||
return " <textarea class='body-textarea' readonly='readonly' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
@@ -1708,7 +1676,7 @@ this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template
|
||||
},"6":function(depth0,helpers,partials,data) {
|
||||
return " (empty)\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "</td>\n<td>\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
|
||||
@@ -1750,6 +1718,39 @@ ParameterContentTypeView = (function(_super) {
|
||||
|
||||
})(Backbone.View);
|
||||
|
||||
this["Handlebars"]["templates"]["param_readonly_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " <textarea class='body-textarea' readonly='readonly' placeholder='(required)' name='"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "'>"
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "</textarea>\n";
|
||||
},"3":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0['default'] : depth0), {"name":"if","hash":{},"fn":this.program(4, data),"inverse":this.program(6, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer;
|
||||
},"4":function(depth0,helpers,partials,data) {
|
||||
var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
|
||||
return " "
|
||||
+ escapeExpression(((helper = (helper = helpers['default'] || (depth0 != null ? depth0['default'] : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"default","hash":{},"data":data}) : helper)))
|
||||
+ "\n";
|
||||
},"6":function(depth0,helpers,partials,data) {
|
||||
return " (empty)\n";
|
||||
},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<td class='code required'>"
|
||||
+ escapeExpression(((helper = (helper = helpers.name || (depth0 != null ? depth0.name : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"name","hash":{},"data":data}) : helper)))
|
||||
+ "</td>\n<td>\n";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isBody : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(3, data),"data":data});
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td class=\"markdown\">";
|
||||
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
buffer += "</td>\n<td>";
|
||||
stack1 = ((helper = (helper = helpers.paramType || (depth0 != null ? depth0.paramType : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"paramType","hash":{},"data":data}) : helper));
|
||||
if (stack1 != null) { buffer += stack1; }
|
||||
return buffer + "</td>\n<td><span class=\"model-signature\"></span></td>\n";
|
||||
},"useData":true});
|
||||
this["Handlebars"]["templates"]["param_required"] = Handlebars.template({"1":function(depth0,helpers,partials,data) {
|
||||
var stack1, buffer = "";
|
||||
stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.isFile : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
+129
-50
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* swagger-client - swagger.js is a javascript client for use with swaggering APIs.
|
||||
* @version v2.1.5-M1
|
||||
* @version v2.1.8-M1
|
||||
* @link http://swagger.io
|
||||
* @license apache 2.0
|
||||
*/
|
||||
@@ -346,8 +346,7 @@ SwaggerClient.prototype.initialize = function (url, options) {
|
||||
if (options.authorizations) {
|
||||
this.clientAuthorizations = options.authorizations;
|
||||
} else {
|
||||
var e = (typeof window !== 'undefined' ? window : exports);
|
||||
this.clientAuthorizations = e.authorizations;
|
||||
this.clientAuthorizations = authorizations;
|
||||
}
|
||||
|
||||
this.supportedSubmitMethods = options.supportedSubmitMethods || [];
|
||||
@@ -407,8 +406,7 @@ SwaggerClient.prototype.build = function(mock) {
|
||||
setTimeout(function() { self.buildFromSpec(self.spec); }, 10);
|
||||
}
|
||||
else {
|
||||
var e = (typeof window !== 'undefined' ? window : exports);
|
||||
var status = e.authorizations.apply(obj);
|
||||
authorizations.apply(obj);
|
||||
if(mock)
|
||||
return obj;
|
||||
new SwaggerHttp().execute(obj);
|
||||
@@ -502,6 +500,8 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
||||
for(i = 0; i < tags.length; i++) {
|
||||
var tag = this.tagFromLabel(tags[i]);
|
||||
var operationGroup = this[tag];
|
||||
if(typeof this.apis[tag] === 'undefined')
|
||||
this.apis[tag] = {};
|
||||
if(typeof operationGroup === 'undefined') {
|
||||
this[tag] = [];
|
||||
operationGroup = this[tag];
|
||||
@@ -516,8 +516,16 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
||||
this[tag].help = this.help.bind(operationGroup);
|
||||
this.apisArray.push(new OperationGroup(tag, operationGroup.description, operationGroup.externalDocs, operationObject));
|
||||
}
|
||||
if(typeof this.apis[tag].help !== 'function')
|
||||
this.apis[tag].help = this.help.bind(operationGroup);
|
||||
// bind to the apis object
|
||||
this.apis[tag][operationId] = operationObject.execute.bind(operationObject);
|
||||
this.apis[tag][operationId].help = operationObject.help.bind(operationObject);
|
||||
this.apis[tag][operationId].asCurl = operationObject.asCurl.bind(operationObject);
|
||||
operationGroup[operationId] = operationObject.execute.bind(operationObject);
|
||||
operationGroup[operationId].help = operationObject.help.bind(operationObject);
|
||||
operationGroup[operationId].asCurl = operationObject.asCurl.bind(operationObject);
|
||||
|
||||
operationGroup.apis.push(operationObject);
|
||||
operationGroup.operations[operationId] = operationObject;
|
||||
|
||||
@@ -560,12 +568,18 @@ SwaggerClient.prototype.parseUri = function(uri) {
|
||||
};
|
||||
};
|
||||
|
||||
SwaggerClient.prototype.help = function() {
|
||||
SwaggerClient.prototype.help = function(dontPrint) {
|
||||
var i;
|
||||
log('operations for the "' + this.label + '" tag');
|
||||
var output = 'operations for the "' + this.label + '" tag';
|
||||
for(i = 0; i < this.apis.length; i++) {
|
||||
var api = this.apis[i];
|
||||
log(' * ' + api.nickname + ': ' + api.operation.summary);
|
||||
output += '\n * ' + api.nickname + ': ' + api.operation.summary;
|
||||
}
|
||||
if(dontPrint)
|
||||
return output;
|
||||
else {
|
||||
log(output);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -817,7 +831,7 @@ Operation.prototype.help = function(dontPrint) {
|
||||
var out = this.nickname + ': ' + this.summary + '\n';
|
||||
for(var i = 0; i < this.parameters.length; i++) {
|
||||
var param = this.parameters[i];
|
||||
var typeInfo = typeFromJsonSchema(param.type, param.format);
|
||||
var typeInfo = param.signature;
|
||||
out += '\n * ' + param.name + ' (' + typeInfo + '): ' + param.description;
|
||||
}
|
||||
if(typeof dontPrint === 'undefined')
|
||||
@@ -935,9 +949,8 @@ Operation.prototype.getMissingParams = function(args) {
|
||||
return missingParams;
|
||||
};
|
||||
|
||||
Operation.prototype.getBody = function(headers, args) {
|
||||
var formParams = {};
|
||||
var body;
|
||||
Operation.prototype.getBody = function(headers, args, opts) {
|
||||
var formParams = {}, body, key;
|
||||
|
||||
for(var i = 0; i < this.parameters.length; i++) {
|
||||
var param = this.parameters[i];
|
||||
@@ -953,7 +966,6 @@ Operation.prototype.getBody = function(headers, args) {
|
||||
// handle form params
|
||||
if(headers['Content-Type'] === 'application/x-www-form-urlencoded') {
|
||||
var encoded = "";
|
||||
var key;
|
||||
for(key in formParams) {
|
||||
value = formParams[key];
|
||||
if(typeof value !== 'undefined'){
|
||||
@@ -964,6 +976,25 @@ Operation.prototype.getBody = function(headers, args) {
|
||||
}
|
||||
body = encoded;
|
||||
}
|
||||
else if (headers['Content-Type'] && headers['Content-Type'].indexOf('multipart/form-data') >= 0) {
|
||||
if(opts.useJQuery) {
|
||||
var bodyParam = new FormData();
|
||||
bodyParam.type = 'formData';
|
||||
for (key in formParams) {
|
||||
value = args[key];
|
||||
if (typeof value !== 'undefined') {
|
||||
// required for jquery file upload
|
||||
if(value.type === 'file' && value.value) {
|
||||
delete headers['Content-Type'];
|
||||
bodyParam.append(key, value.value);
|
||||
}
|
||||
else
|
||||
bodyParam.append(key, value);
|
||||
}
|
||||
}
|
||||
body = bodyParam;
|
||||
}
|
||||
}
|
||||
|
||||
return body;
|
||||
};
|
||||
@@ -1026,9 +1057,8 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
success = (success||log);
|
||||
error = (error||log);
|
||||
|
||||
if(typeof opts.useJQuery === 'boolean') {
|
||||
if(opts.useJQuery)
|
||||
this.useJQuery = opts.useJQuery;
|
||||
}
|
||||
|
||||
var missingParams = this.getMissingParams(args);
|
||||
if(missingParams.length > 0) {
|
||||
@@ -1043,7 +1073,7 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
for (attrname in allHeaders) { headers[attrname] = allHeaders[attrname]; }
|
||||
for (attrname in contentTypeHeaders) { headers[attrname] = contentTypeHeaders[attrname]; }
|
||||
|
||||
var body = this.getBody(headers, args);
|
||||
var body = this.getBody(headers, args, opts);
|
||||
var url = this.urlify(args);
|
||||
|
||||
var obj = {
|
||||
@@ -1061,7 +1091,7 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
}
|
||||
}
|
||||
};
|
||||
var status = e.authorizations.apply(obj, this.operation.security);
|
||||
var status = authorizations.apply(obj, this.operation.security);
|
||||
if(opts.mock === true)
|
||||
return obj;
|
||||
else
|
||||
@@ -1144,14 +1174,24 @@ Operation.prototype.setContentTypes = function(args, opts) {
|
||||
};
|
||||
|
||||
Operation.prototype.asCurl = function (args) {
|
||||
var obj = this.execute(args, {mock: true});
|
||||
authorizations.apply(obj);
|
||||
var results = [];
|
||||
var headers = this.getHeaderParams(args);
|
||||
if (headers) {
|
||||
results.push('-X ' + this.method.toUpperCase());
|
||||
if (obj.headers) {
|
||||
var key;
|
||||
for (key in headers)
|
||||
results.push("--header \"" + key + ": " + headers[key] + "\"");
|
||||
for (key in obj.headers)
|
||||
results.push('--header "' + key + ': ' + obj.headers[key] + '"');
|
||||
}
|
||||
return "curl " + (results.join(" ")) + " " + this.urlify(args);
|
||||
if(obj.body) {
|
||||
var body;
|
||||
if(typeof obj.body === 'object')
|
||||
body = JSON.stringify(obj.body);
|
||||
else
|
||||
body = obj.body;
|
||||
results.push('-d "' + body.replace(/"/g, '\\"') + '"');
|
||||
}
|
||||
return 'curl ' + (results.join(' ')) + ' "' + obj.url + '"';
|
||||
};
|
||||
|
||||
Operation.prototype.encodePathCollection = function(type, name, value) {
|
||||
@@ -1259,12 +1299,12 @@ var Model = function(name, definition) {
|
||||
};
|
||||
|
||||
Model.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var i, result = {};
|
||||
var i, result = {}, representations = {};
|
||||
modelsToIgnore = (modelsToIgnore||{});
|
||||
modelsToIgnore[this.name] = this;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
prop = this.properties[i];
|
||||
var sample = prop.getSampleValue(modelsToIgnore);
|
||||
var sample = prop.getSampleValue(modelsToIgnore, representations);
|
||||
result[prop.name] = sample;
|
||||
}
|
||||
delete modelsToIgnore[this.name];
|
||||
@@ -1272,10 +1312,10 @@ Model.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
};
|
||||
|
||||
Model.prototype.getSampleValue = function(modelsToIgnore) {
|
||||
var i, obj = {};
|
||||
var i, obj = {}, representations = {};
|
||||
for(i = 0; i < this.properties.length; i++ ) {
|
||||
var property = this.properties[i];
|
||||
obj[property.name] = property.sampleValue(false, modelsToIgnore);
|
||||
obj[property.name] = property.sampleValue(false, modelsToIgnore, representations);
|
||||
}
|
||||
return obj;
|
||||
};
|
||||
@@ -1340,8 +1380,8 @@ var Property = function(name, obj, required) {
|
||||
this.multipleOf = obj.multipleOf || null;
|
||||
};
|
||||
|
||||
Property.prototype.getSampleValue = function (modelsToIgnore) {
|
||||
return this.sampleValue(false, modelsToIgnore);
|
||||
Property.prototype.getSampleValue = function (modelsToIgnore, representations) {
|
||||
return this.sampleValue(false, modelsToIgnore, representations);
|
||||
};
|
||||
|
||||
Property.prototype.isArray = function () {
|
||||
@@ -1352,21 +1392,29 @@ Property.prototype.isArray = function () {
|
||||
return false;
|
||||
};
|
||||
|
||||
Property.prototype.sampleValue = function(isArray, ignoredModels) {
|
||||
Property.prototype.sampleValue = function(isArray, ignoredModels, representations) {
|
||||
isArray = (isArray || this.isArray());
|
||||
ignoredModels = (ignoredModels || {});
|
||||
// representations = (representations || {});
|
||||
|
||||
var type = getStringSignature(this.obj, true);
|
||||
var output;
|
||||
|
||||
if(this.$ref) {
|
||||
var refModelName = simpleRef(this.$ref);
|
||||
var refModel = models[refModelName];
|
||||
if(typeof representations[type] !== 'undefined') {
|
||||
return representations[type];
|
||||
}
|
||||
else
|
||||
|
||||
if(refModel && typeof ignoredModels[type] === 'undefined') {
|
||||
ignoredModels[type] = this;
|
||||
output = refModel.getSampleValue(ignoredModels);
|
||||
output = refModel.getSampleValue(ignoredModels, representations);
|
||||
representations[type] = output;
|
||||
}
|
||||
else {
|
||||
output = refModelName;
|
||||
output = (representations[type] || refModelName);
|
||||
}
|
||||
}
|
||||
else if(this.example)
|
||||
@@ -1610,6 +1658,7 @@ SwaggerClient.prototype.buildFrom1_2Spec = function (response) {
|
||||
res = new SwaggerResource(response, this);
|
||||
this.apis[newName] = res;
|
||||
this.apisArray.push(res);
|
||||
this.finish();
|
||||
} else {
|
||||
var k;
|
||||
this.expectedResourceCount = response.apis.length;
|
||||
@@ -1665,7 +1714,9 @@ SwaggerClient.prototype.buildFrom1_1Spec = function (response) {
|
||||
res = new SwaggerResource(response, this);
|
||||
this.apis[newName] = res;
|
||||
this.apisArray.push(res);
|
||||
this.finish();
|
||||
} else {
|
||||
this.expectedResourceCount = response.apis.length;
|
||||
for (k = 0; k < response.apis.length; k++) {
|
||||
resource = response.apis[k];
|
||||
res = new SwaggerResource(resource, this);
|
||||
@@ -1674,9 +1725,6 @@ SwaggerClient.prototype.buildFrom1_1Spec = function (response) {
|
||||
}
|
||||
}
|
||||
this.isValid = true;
|
||||
if (this.success) {
|
||||
this.success();
|
||||
}
|
||||
return this;
|
||||
};
|
||||
|
||||
@@ -1698,16 +1746,18 @@ SwaggerClient.prototype.convertInfo = function (resp) {
|
||||
};
|
||||
|
||||
SwaggerClient.prototype.selfReflect = function () {
|
||||
var resource, resource_name, ref;
|
||||
var resource, tag, ref;
|
||||
if (this.apis === null) {
|
||||
return false;
|
||||
}
|
||||
ref = this.apis;
|
||||
for (resource_name in ref) {
|
||||
resource = ref[resource_name];
|
||||
if (resource.ready === null) {
|
||||
for (tag in ref) {
|
||||
api = ref[tag];
|
||||
if (api.ready === null) {
|
||||
return false;
|
||||
}
|
||||
this[tag] = api;
|
||||
this[tag].help = __bind(api.help, api);
|
||||
}
|
||||
this.setConsolidatedModels();
|
||||
this.ready = true;
|
||||
@@ -1743,7 +1793,6 @@ var SwaggerResource = function (resourceObj, api) {
|
||||
this.description = resourceObj.description;
|
||||
this.authorizations = (resourceObj.authorizations || {});
|
||||
|
||||
|
||||
var parts = this.path.split('/');
|
||||
this.name = parts[parts.length - 1].replace('.{format}', '');
|
||||
this.basePath = this.api.basePath;
|
||||
@@ -1792,6 +1841,21 @@ var SwaggerResource = function (resourceObj, api) {
|
||||
}
|
||||
};
|
||||
|
||||
SwaggerResource.prototype.help = function (dontPrint) {
|
||||
var i;
|
||||
var output = 'operations for the "' + this.name + '" tag';
|
||||
for(i = 0; i < this.operationsArray.length; i++) {
|
||||
var api = this.operationsArray[i];
|
||||
output += '\n * ' + api.nickname + ': ' + api.description;
|
||||
}
|
||||
if(dontPrint)
|
||||
return output;
|
||||
else {
|
||||
log(output);
|
||||
return output;
|
||||
}
|
||||
};
|
||||
|
||||
SwaggerResource.prototype.getAbsoluteBasePath = function (relativeBasePath) {
|
||||
var pos, url;
|
||||
url = this.api.basePath;
|
||||
@@ -2108,6 +2172,7 @@ var SwaggerOperation = function (nickname, path, method, parameters, summary, no
|
||||
this.deprecated = deprecated;
|
||||
this['do'] = __bind(this['do'], this);
|
||||
|
||||
|
||||
if(typeof this.deprecated === 'string') {
|
||||
switch(this.deprecated.toLowerCase()) {
|
||||
case 'true': case 'yes': case '1': {
|
||||
@@ -2225,8 +2290,8 @@ var SwaggerOperation = function (nickname, path, method, parameters, summary, no
|
||||
return _this['do'](arg1 || {}, arg2 || {}, arg3 || defaultSuccessCallback, arg4 || defaultErrorCallback);
|
||||
};
|
||||
|
||||
this.resource[this.nickname].help = function () {
|
||||
return _this.help();
|
||||
this.resource[this.nickname].help = function (dontPrint) {
|
||||
return _this.help(dontPrint);
|
||||
};
|
||||
this.resource[this.nickname].asCurl = function (args) {
|
||||
return _this.asCurl(args);
|
||||
@@ -2465,16 +2530,19 @@ SwaggerOperation.prototype.getMatchingParams = function (paramTypes, args) {
|
||||
return matchingParams;
|
||||
};
|
||||
|
||||
SwaggerOperation.prototype.help = function () {
|
||||
var msg = '';
|
||||
SwaggerOperation.prototype.help = function (dontPrint) {
|
||||
var msg = this.nickname + ': ' + this.summary;
|
||||
var params = this.parameters;
|
||||
for (var i = 0; i < params.length; i++) {
|
||||
var param = params[i];
|
||||
if (msg !== '')
|
||||
msg += '\n';
|
||||
msg += '* ' + param.name + (param.required ? ' (required)' : '') + " - " + param.description;
|
||||
msg += '\n* ' + param.name + (param.required ? ' (required)' : '') + " - " + param.description;
|
||||
}
|
||||
if(dontPrint)
|
||||
return msg;
|
||||
else {
|
||||
console.log(msg);
|
||||
return msg;
|
||||
}
|
||||
return msg;
|
||||
};
|
||||
|
||||
SwaggerOperation.prototype.asCurl = function (args) {
|
||||
@@ -2768,7 +2836,14 @@ SwaggerHttp.prototype.execute = function(obj, opts) {
|
||||
this.useJQuery = this.isIE8();
|
||||
|
||||
if(obj && typeof obj.body === 'object') {
|
||||
obj.body = JSON.stringify(obj.body);
|
||||
if(obj.body.type && obj.body.type !== 'formData')
|
||||
obj.body = JSON.stringify(obj.body);
|
||||
else {
|
||||
obj.contentType = false;
|
||||
obj.processData = false;
|
||||
// delete obj.cache;
|
||||
delete obj.headers['Content-Type'];
|
||||
}
|
||||
}
|
||||
|
||||
if(this.useJQuery)
|
||||
@@ -2809,7 +2884,9 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
|
||||
obj.type = obj.method;
|
||||
obj.cache = false;
|
||||
delete obj.useJQuery;
|
||||
|
||||
/*
|
||||
obj.beforeSend = function(xhr) {
|
||||
var key, results;
|
||||
if (obj.headers) {
|
||||
@@ -2825,9 +2902,10 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
}
|
||||
return results;
|
||||
}
|
||||
};
|
||||
};*/
|
||||
|
||||
obj.data = obj.body;
|
||||
delete obj.body;
|
||||
obj.complete = function(response, textStatus, opts) {
|
||||
var headers = {},
|
||||
headerArray = response.getAllResponseHeaders().split("\n");
|
||||
@@ -2851,6 +2929,7 @@ JQueryHttpClient.prototype.execute = function(obj) {
|
||||
url: request.url,
|
||||
method: request.method,
|
||||
status: response.status,
|
||||
statusText: response.statusText,
|
||||
data: response.responseText,
|
||||
headers: headers
|
||||
};
|
||||
@@ -3000,7 +3079,7 @@ ShredHttpClient.prototype.execute = function(obj) {
|
||||
|
||||
var e = (typeof window !== 'undefined' ? window : exports);
|
||||
|
||||
e.authorizations = new SwaggerAuthorizations();
|
||||
e.authorizations = authorizations = new SwaggerAuthorizations();
|
||||
e.ApiKeyAuthorization = ApiKeyAuthorization;
|
||||
e.PasswordAuthorization = PasswordAuthorization;
|
||||
e.CookieAuthorization = CookieAuthorization;
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
"name": "swagger-ui",
|
||||
"author": "Tony Tam <fehguy@gmail.com>",
|
||||
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
|
||||
"version": "2.1.5-M1",
|
||||
"version": "2.1.6-M1",
|
||||
"homepage": "http://swagger.io",
|
||||
"license": "Apache 2.0",
|
||||
"scripts": {
|
||||
@@ -18,7 +18,7 @@
|
||||
"dependencies": {
|
||||
"shred": "0.8.10",
|
||||
"btoa": "1.1.1",
|
||||
"swagger-client": "2.1.5-M1"
|
||||
"swagger-client": "2.1.8-M1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^1.10.0",
|
||||
|
||||
@@ -195,6 +195,7 @@ class OperationView extends Backbone.View
|
||||
if(o.value? && jQuery.trim(o.value).length > 0)
|
||||
map[o.name] = o.value
|
||||
if o.type is "file"
|
||||
map[o.name] = o.files[0]
|
||||
isFileUpload = true
|
||||
|
||||
for o in form.find("textarea")
|
||||
@@ -229,7 +230,7 @@ class OperationView extends Backbone.View
|
||||
|
||||
# add params
|
||||
for param in @model.parameters
|
||||
if param.paramType is 'form'
|
||||
if param.paramType is 'form' or param.in is 'formData'
|
||||
if param.type.toLowerCase() isnt 'file' and map[param.name] != undefined
|
||||
bodyParam.append(param.name, map[param.name])
|
||||
|
||||
|
||||
@@ -105,6 +105,14 @@ describe('swagger 2.0 spec tests', function (done) {
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the pet resource description', function(done){
|
||||
var locator = webdriver.By.xpath("//div[contains(., 'Everything about your Pets')]");
|
||||
driver.findElements(locator).then(function (elements) {
|
||||
expect(elements.length).to.not.equal(0);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should find the user link', function(done){
|
||||
var locator = webdriver.By.xpath("//*[@data-id='user']");
|
||||
driver.isElementPresent(locator).then(function (isPresent) {
|
||||
|
||||
@@ -20,6 +20,28 @@
|
||||
"schemes": [
|
||||
"http"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"name": "user",
|
||||
"description": "Operations about user"
|
||||
},
|
||||
{
|
||||
"name": "store",
|
||||
"description": "Access to Petstore orders",
|
||||
"externalDocs": {
|
||||
"description": "Find out more",
|
||||
"url": "http://swagger.io"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "pet",
|
||||
"description": "Everything about your Pets",
|
||||
"externalDocs": {
|
||||
"description": "Find out more",
|
||||
"url": "http://swagger.io"
|
||||
}
|
||||
}
|
||||
],
|
||||
"paths": {
|
||||
"/pet": {
|
||||
"post": {
|
||||
|
||||
Reference in New Issue
Block a user