updated version check, multi support for 2.0
This commit is contained in:
401
dist/lib/swagger-client.js
vendored
401
dist/lib/swagger-client.js
vendored
@@ -1,5 +1,61 @@
|
||||
// swagger-client.js
|
||||
// version 2.1.0
|
||||
// version 2.1.0-alpha.1
|
||||
/**
|
||||
* Array Model
|
||||
**/
|
||||
var ArrayModel = function(definition) {
|
||||
this.name = "name";
|
||||
this.definition = definition || {};
|
||||
this.properties = [];
|
||||
this.type;
|
||||
this.ref;
|
||||
|
||||
var requiredFields = definition.enum || [];
|
||||
var items = definition.items;
|
||||
if(items) {
|
||||
var type = items.type;
|
||||
if(items.type) {
|
||||
this.type = typeFromJsonSchema(type.type, type.format);
|
||||
}
|
||||
else {
|
||||
this.ref = items['$ref'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArrayModel.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result;
|
||||
modelsToIgnore = (modelsToIgnore||{})
|
||||
if(this.type) {
|
||||
result = type;
|
||||
}
|
||||
else if (this.ref) {
|
||||
var name = simpleRef(this.ref);
|
||||
result = models[name].createJSONSample();
|
||||
}
|
||||
return [ result ];
|
||||
};
|
||||
|
||||
ArrayModel.prototype.getSampleValue = function(modelsToIgnore) {
|
||||
var result;
|
||||
modelsToIgnore = (modelsToIgnore || {})
|
||||
if(this.type) {
|
||||
result = type;
|
||||
}
|
||||
else if (this.ref) {
|
||||
var name = simpleRef(this.ref);
|
||||
result = models[name].getSampleValue(modelsToIgnore);
|
||||
}
|
||||
return [ result ];
|
||||
}
|
||||
|
||||
ArrayModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var propertiesStr = [];
|
||||
|
||||
if(this.ref) {
|
||||
return models[simpleRef(this.ref)].getMockSignature();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* SwaggerAuthorizations applys the correct authorization to an operation being executed
|
||||
@@ -177,7 +233,58 @@ Object.keys = Object.keys || (function () {
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var SwaggerClient = function(url, options) {
|
||||
/**
|
||||
* PrimitiveModel
|
||||
**/
|
||||
var PrimitiveModel = function(definition) {
|
||||
this.name = "name";
|
||||
this.definition = definition || {};
|
||||
this.properties = [];
|
||||
this.type;
|
||||
|
||||
var requiredFields = definition.enum || [];
|
||||
this.type = typeFromJsonSchema(definition.type, definition.format);
|
||||
}
|
||||
|
||||
PrimitiveModel.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result = this.type;
|
||||
return result;
|
||||
};
|
||||
|
||||
PrimitiveModel.prototype.getSampleValue = function() {
|
||||
var result = this.type;
|
||||
return null;
|
||||
}
|
||||
|
||||
PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var propertiesStr = [];
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
var prop = this.properties[i];
|
||||
propertiesStr.push(prop.toString());
|
||||
}
|
||||
|
||||
var strong = '<span class="strong">';
|
||||
var stronger = '<span class="stronger">';
|
||||
var strongClose = '</span>';
|
||||
var classOpen = strong + this.name + ' {' + strongClose;
|
||||
var classClose = strong + '}' + strongClose;
|
||||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
||||
|
||||
if (!modelsToIgnore)
|
||||
modelsToIgnore = {};
|
||||
modelsToIgnore[this.name] = this;
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
var prop = this.properties[i];
|
||||
var ref = prop['$ref'];
|
||||
var model = models[ref];
|
||||
if (model && typeof modelsToIgnore[ref] === 'undefined') {
|
||||
returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
};var SwaggerClient = function(url, options) {
|
||||
this.isBuilt = false;
|
||||
this.url = null;
|
||||
this.debug = false;
|
||||
@@ -237,7 +344,7 @@ SwaggerClient.prototype.build = function() {
|
||||
var responseObj = resp.obj || JSON.parse(resp.data);
|
||||
self.swaggerVersion = responseObj.swaggerVersion;
|
||||
|
||||
if(responseObj.swagger && responseObj.swagger === 2.0) {
|
||||
if(responseObj.swagger && parseInt(responseObj.swagger) === 2) {
|
||||
self.swaggerVersion = responseObj.swagger;
|
||||
self.buildFromSpec(responseObj);
|
||||
self.isValid = true;
|
||||
@@ -251,9 +358,7 @@ SwaggerClient.prototype.build = function() {
|
||||
};
|
||||
if(this.spec) {
|
||||
var self = this;
|
||||
setTimeout(function() {
|
||||
self.buildFromSpec(self.spec);
|
||||
}, 10);
|
||||
setTimeout(function() { self.buildFromSpec(self.spec); }, 10);
|
||||
}
|
||||
else {
|
||||
var e = (typeof window !== 'undefined' ? window : exports);
|
||||
@@ -265,8 +370,8 @@ SwaggerClient.prototype.build = function() {
|
||||
};
|
||||
|
||||
SwaggerClient.prototype.buildFromSpec = function(response) {
|
||||
if(this.isBuilt)
|
||||
return this;
|
||||
if(this.isBuilt) return this;
|
||||
|
||||
this.info = response.info || {};
|
||||
this.title = response.title || '';
|
||||
this.host = response.host || '';
|
||||
@@ -333,7 +438,7 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
||||
|
||||
// legacy UI feature
|
||||
var j;
|
||||
var api = null;
|
||||
var api;
|
||||
for(j = 0; j < this.apisArray.length; j++) {
|
||||
if(this.apisArray[j].tag === tag) {
|
||||
api = this.apisArray[j];
|
||||
@@ -425,10 +530,30 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition
|
||||
var i;
|
||||
for(i = 0; i < this.parameters.length; i++) {
|
||||
var param = this.parameters[i];
|
||||
type = this.getType(param);
|
||||
|
||||
param.signature = this.getSignature(type, models);
|
||||
param.sampleJSON = this.getSampleJSON(type, models);
|
||||
if(param.type === 'array') {
|
||||
param.isList = true;
|
||||
param.allowMultiple = true;
|
||||
}
|
||||
var innerType = this.getType(param);
|
||||
if(innerType.toString().toLowerCase() === 'boolean') {
|
||||
param.allowableValues = {};
|
||||
param.isList = true;
|
||||
param.enum = ["true", "false"];
|
||||
}
|
||||
if(typeof param.enum !== 'undefined') {
|
||||
var id;
|
||||
param.allowableValues = {};
|
||||
param.allowableValues.values = [];
|
||||
param.allowableValues.descriptiveValues = [];
|
||||
for(id = 0; id < param.enum.length; id++) {
|
||||
var value = param.enum[id];
|
||||
var isDefault = (value === param.default) ? true : false;
|
||||
param.allowableValues.values.push(value);
|
||||
param.allowableValues.descriptiveValues.push({value : value, isDefault: isDefault});
|
||||
}
|
||||
}
|
||||
param.signature = this.getSignature(innerType, models);
|
||||
param.sampleJSON = this.getSampleJSON(innerType, models);
|
||||
param.responseClassSignature = param.signature;
|
||||
}
|
||||
|
||||
@@ -577,14 +702,16 @@ Operation.prototype.getSignature = function(type, models) {
|
||||
if (isPrimitive) {
|
||||
return type;
|
||||
} else {
|
||||
if (listType != null) {
|
||||
if (listType != null)
|
||||
return models[type].getMockSignature();
|
||||
} else {
|
||||
else
|
||||
return models[type].getMockSignature();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* gets sample response for a single operation
|
||||
**/
|
||||
Operation.prototype.getSampleJSON = function(type, models) {
|
||||
var isPrimitive, listType, sampleJson;
|
||||
|
||||
@@ -613,11 +740,16 @@ Operation.prototype.getSampleJSON = function(type, models) {
|
||||
}
|
||||
};
|
||||
|
||||
// legacy support
|
||||
/**
|
||||
* legacy binding
|
||||
**/
|
||||
Operation.prototype["do"] = function(args, opts, callback, error, parent) {
|
||||
return this.execute(args, opts, callback, error, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* executes an operation
|
||||
**/
|
||||
Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
var args = (arg1||{});
|
||||
var opts = {}, success, error;
|
||||
@@ -640,8 +772,9 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
|
||||
var requiredParams = [];
|
||||
var missingParams = [];
|
||||
// check required params
|
||||
for(var i = 0; i < this.parameters.length; i++) {
|
||||
// check required params, track the ones that are missing
|
||||
var i;
|
||||
for(i = 0; i < this.parameters.length; i++) {
|
||||
var param = this.parameters[i];
|
||||
if(param.required === true) {
|
||||
requiredParams.push(param.name);
|
||||
@@ -688,10 +821,25 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
}
|
||||
else if (param.in === 'header')
|
||||
headers[param.name] = args[param.name];
|
||||
else if (param.in === 'form')
|
||||
else if (param.in === 'formData')
|
||||
formParams[param.name] = args[param.name];
|
||||
}
|
||||
}
|
||||
// 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'){
|
||||
if(encoded !== "")
|
||||
encoded += "&";
|
||||
encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||
}
|
||||
}
|
||||
// todo append?
|
||||
args.body = encoded;
|
||||
}
|
||||
var scheme = this.schemes[0];
|
||||
var url = scheme + '://' + this.host + this.basePath + requestUrl + querystring;
|
||||
|
||||
@@ -729,7 +877,7 @@ Operation.prototype.setContentTypes = function(args, opts) {
|
||||
var i;
|
||||
for(i = 0; i < allDefinedParams.length; i++) {
|
||||
var param = allDefinedParams[i];
|
||||
if(param.in === 'form')
|
||||
if(param.in === 'formData')
|
||||
definedFormParams.push(param);
|
||||
else if(param.in === 'file')
|
||||
definedFileParams.push(param);
|
||||
@@ -788,19 +936,45 @@ Operation.prototype.setContentTypes = function(args, opts) {
|
||||
Operation.prototype.encodeCollection = function(type, name, value) {
|
||||
var encoded = '';
|
||||
var i;
|
||||
if(type === 'jaxrs') {
|
||||
if(type === 'default' || type === 'multi') {
|
||||
for(i = 0; i < value.length; i++) {
|
||||
if(i > 0) encoded += '&'
|
||||
encoded += this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var separator = '';
|
||||
if(type === 'csv')
|
||||
separator = ',';
|
||||
else if(type === 'ssv')
|
||||
separator = '%20';
|
||||
else if(type === 'tsv')
|
||||
separator = '\\t';
|
||||
else if(type === 'pipes')
|
||||
separator = '|';
|
||||
if(separator !== '') {
|
||||
for(i = 0; i < value.length; i++) {
|
||||
if(i == 0)
|
||||
encoded = this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
|
||||
else
|
||||
encoded += separator + this.encodeQueryParam(value[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: support the different encoding schemes here
|
||||
return encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO this encoding needs to be changed
|
||||
**/
|
||||
Operation.prototype.encodeQueryParam = function(arg) {
|
||||
return escape(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO revisit, might not want to leave '/'
|
||||
**/
|
||||
Operation.prototype.encodePathParam = function(pathParam) {
|
||||
var encParts, part, parts, _i, _len;
|
||||
pathParam = pathParam.toString();
|
||||
@@ -817,127 +991,6 @@ Operation.prototype.encodePathParam = function(pathParam) {
|
||||
}
|
||||
};
|
||||
|
||||
Operation.prototype.encodePathParam = function(pathParam) {
|
||||
var encParts, part, parts, _i, _len;
|
||||
pathParam = pathParam.toString();
|
||||
if (pathParam.indexOf('/') === -1) {
|
||||
return encodeURIComponent(pathParam);
|
||||
} else {
|
||||
parts = pathParam.split('/');
|
||||
encParts = [];
|
||||
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
||||
part = parts[_i];
|
||||
encParts.push(encodeURIComponent(part));
|
||||
}
|
||||
return encParts.join('/');
|
||||
}
|
||||
};
|
||||
|
||||
var ArrayModel = function(definition) {
|
||||
this.name = "name";
|
||||
this.definition = definition || {};
|
||||
this.properties = [];
|
||||
this.type;
|
||||
this.ref;
|
||||
|
||||
var requiredFields = definition.enum || [];
|
||||
var items = definition.items;
|
||||
if(items) {
|
||||
var type = items.type;
|
||||
if(items.type) {
|
||||
this.type = typeFromJsonSchema(type.type, type.format);
|
||||
}
|
||||
else {
|
||||
this.ref = items['$ref'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArrayModel.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result;
|
||||
var modelsToIgnore = (modelsToIgnore||[])
|
||||
if(this.type) {
|
||||
result = type;
|
||||
}
|
||||
else if (this.ref) {
|
||||
var name = simpleRef(this.ref);
|
||||
result = models[name].createJSONSample();
|
||||
}
|
||||
return [ result ];
|
||||
};
|
||||
|
||||
ArrayModel.prototype.getSampleValue = function() {
|
||||
var result;
|
||||
var modelsToIgnore = (modelsToIgnore||[])
|
||||
if(this.type) {
|
||||
result = type;
|
||||
}
|
||||
else if (this.ref) {
|
||||
var name = simpleRef(this.ref);
|
||||
result = models[name].getSampleValue();
|
||||
}
|
||||
return [ result ];
|
||||
}
|
||||
|
||||
ArrayModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var propertiesStr = [];
|
||||
|
||||
if(this.ref) {
|
||||
return models[simpleRef(this.ref)].getMockSignature();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var PrimitiveModel = function(definition) {
|
||||
this.name = "name";
|
||||
this.definition = definition || {};
|
||||
this.properties = [];
|
||||
this.type;
|
||||
|
||||
var requiredFields = definition.enum || [];
|
||||
this.type = typeFromJsonSchema(definition.type, definition.format);
|
||||
}
|
||||
|
||||
PrimitiveModel.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result = this.type;
|
||||
return result;
|
||||
};
|
||||
|
||||
PrimitiveModel.prototype.getSampleValue = function() {
|
||||
var result = this.type;
|
||||
return null;
|
||||
}
|
||||
|
||||
PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var propertiesStr = [];
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
var prop = this.properties[i];
|
||||
propertiesStr.push(prop.toString());
|
||||
}
|
||||
|
||||
var strong = '<span class="strong">';
|
||||
var stronger = '<span class="stronger">';
|
||||
var strongClose = '</span>';
|
||||
var classOpen = strong + this.name + ' {' + strongClose;
|
||||
var classClose = strong + '}' + strongClose;
|
||||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
||||
if (!modelsToIgnore)
|
||||
modelsToIgnore = [];
|
||||
|
||||
modelsToIgnore.push(this.name);
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
var prop = this.properties[i];
|
||||
var ref = prop['$ref'];
|
||||
var model = models[ref];
|
||||
if (model && modelsToIgnore.indexOf(ref) === -1) {
|
||||
returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
};
|
||||
|
||||
var Model = function(name, definition) {
|
||||
this.name = name;
|
||||
this.definition = definition || {};
|
||||
@@ -959,22 +1012,23 @@ var Model = function(name, definition) {
|
||||
|
||||
Model.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result = {};
|
||||
var modelsToIgnore = (modelsToIgnore||[])
|
||||
modelsToIgnore.push(this.name);
|
||||
for (var i = 0; i < this.properties.length; i++) {
|
||||
modelsToIgnore = (modelsToIgnore||{})
|
||||
modelsToIgnore[this.name] = this;
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
prop = this.properties[i];
|
||||
result[prop.name] = prop.getSampleValue(modelsToIgnore);
|
||||
}
|
||||
modelsToIgnore.pop(this.name);
|
||||
delete modelsToIgnore[this.name];
|
||||
return result;
|
||||
};
|
||||
|
||||
Model.prototype.getSampleValue = function() {
|
||||
Model.prototype.getSampleValue = function(modelsToIgnore) {
|
||||
var i;
|
||||
var obj = {};
|
||||
for(i = 0; i < this.properties.length; i++ ) {
|
||||
var property = this.properties[i];
|
||||
obj[property.name] = property.sampleValue();
|
||||
obj[property.name] = property.sampleValue(false, modelsToIgnore);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
@@ -994,15 +1048,15 @@ Model.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var classClose = strong + '}' + strongClose;
|
||||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
||||
if (!modelsToIgnore)
|
||||
modelsToIgnore = [];
|
||||
modelsToIgnore = {};
|
||||
|
||||
modelsToIgnore.push(this.name);
|
||||
modelsToIgnore[this.name] = this;
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
var prop = this.properties[i];
|
||||
var ref = prop['$ref'];
|
||||
var model = models[ref];
|
||||
if (model && modelsToIgnore.indexOf(ref) === -1) {
|
||||
if (model && typeof modelsToIgnore === 'undefined') {
|
||||
returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
|
||||
}
|
||||
}
|
||||
@@ -1029,8 +1083,8 @@ var Property = function(name, obj, required) {
|
||||
this.example = obj.example || null;
|
||||
}
|
||||
|
||||
Property.prototype.getSampleValue = function () {
|
||||
return this.sampleValue(false);
|
||||
Property.prototype.getSampleValue = function (modelsToIgnore) {
|
||||
return this.sampleValue(false, modelsToIgnore);
|
||||
}
|
||||
|
||||
Property.prototype.isArray = function () {
|
||||
@@ -1043,13 +1097,14 @@ Property.prototype.isArray = function () {
|
||||
|
||||
Property.prototype.sampleValue = function(isArray, ignoredModels) {
|
||||
isArray = (isArray || this.isArray());
|
||||
ignoredModels = (ignoredModels || {})
|
||||
ignoredModels = (ignoredModels || {});
|
||||
var type = getStringSignature(this.obj);
|
||||
var output;
|
||||
|
||||
if(this['$ref']) {
|
||||
var refModel = models[this['$ref']];
|
||||
if(refModel && typeof ignoredModels[refModel] === 'undefined') {
|
||||
if(refModel && typeof ignoredModels[type] === 'undefined') {
|
||||
ignoredModels[type] = this;
|
||||
output = refModel.getSampleValue(ignoredModels);
|
||||
}
|
||||
else
|
||||
@@ -1057,31 +1112,27 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) {
|
||||
}
|
||||
else if(this.example)
|
||||
output = this.example;
|
||||
else if(type === 'date-time') {
|
||||
else if(type === 'date-time')
|
||||
output = new Date().toISOString();
|
||||
}
|
||||
else if(type === 'string') {
|
||||
else if(type === 'string')
|
||||
output = 'string';
|
||||
}
|
||||
else if(type === 'integer') {
|
||||
else if(type === 'integer')
|
||||
output = 0;
|
||||
}
|
||||
else if(type === 'long') {
|
||||
else if(type === 'long')
|
||||
output = 0;
|
||||
}
|
||||
else if(type === 'float') {
|
||||
else if(type === 'float')
|
||||
output = 0.0;
|
||||
}
|
||||
else if(type === 'double') {
|
||||
else if(type === 'double')
|
||||
output = 0.0;
|
||||
}
|
||||
else if(type === 'boolean') {
|
||||
else if(type === 'boolean')
|
||||
output = true;
|
||||
}
|
||||
else
|
||||
output = {};
|
||||
if(isArray) return [output];
|
||||
else return output;
|
||||
ignoredModels[type] = output;
|
||||
if(isArray)
|
||||
return [output];
|
||||
else
|
||||
return output;
|
||||
}
|
||||
|
||||
getStringSignature = function(obj) {
|
||||
@@ -1161,7 +1212,9 @@ e.authorizations = new SwaggerAuthorizations();
|
||||
e.ApiKeyAuthorization = ApiKeyAuthorization;
|
||||
e.PasswordAuthorization = PasswordAuthorization;
|
||||
e.CookieAuthorization = CookieAuthorization;
|
||||
e.SwaggerClient = SwaggerClient;/**
|
||||
e.SwaggerClient = SwaggerClient;
|
||||
|
||||
/**
|
||||
* SwaggerHttp is a wrapper for executing requests
|
||||
*/
|
||||
var SwaggerHttp = function() {};
|
||||
@@ -1295,7 +1348,7 @@ var ShredHttpClient = function(options) {
|
||||
}
|
||||
else
|
||||
this.Shred = require("shred");
|
||||
this.shred = new this.Shred();
|
||||
this.shred = new this.Shred(options);
|
||||
}
|
||||
|
||||
ShredHttpClient.prototype.initShred = function () {
|
||||
|
||||
17
dist/lib/swagger.js
vendored
17
dist/lib/swagger.js
vendored
@@ -975,9 +975,22 @@
|
||||
var param = params[i];
|
||||
if (param.paramType === 'query') {
|
||||
if (args[param.name] !== undefined) {
|
||||
var value = args[param.name];
|
||||
if (queryParams !== '')
|
||||
queryParams += "&";
|
||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||
queryParams += '&';
|
||||
if (Array.isArray(value)) {
|
||||
var j;
|
||||
var output = '';
|
||||
for(j = 0; j < value.length; j++) {
|
||||
if(j > 0)
|
||||
output += ',';
|
||||
output += encodeURIComponent(value[j]);
|
||||
}
|
||||
queryParams += encodeURIComponent(param.name) + '=' + output;
|
||||
}
|
||||
else {
|
||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
4
dist/swagger-ui.js
vendored
4
dist/swagger-ui.js
vendored
@@ -1,5 +1,5 @@
|
||||
// swagger-ui.js
|
||||
// version 2.1.0
|
||||
// version 2.1.0-alpha.1
|
||||
$(function() {
|
||||
|
||||
// Helper function for vertically aligning DOM elements
|
||||
@@ -1977,7 +1977,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
|
||||
}
|
||||
}
|
||||
if (options.length > 0) {
|
||||
return options.join(",");
|
||||
return options;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
2
dist/swagger-ui.min.js
vendored
2
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,5 +1,61 @@
|
||||
// swagger-client.js
|
||||
// version 2.1.0
|
||||
// version 2.1.0-alpha.1
|
||||
/**
|
||||
* Array Model
|
||||
**/
|
||||
var ArrayModel = function(definition) {
|
||||
this.name = "name";
|
||||
this.definition = definition || {};
|
||||
this.properties = [];
|
||||
this.type;
|
||||
this.ref;
|
||||
|
||||
var requiredFields = definition.enum || [];
|
||||
var items = definition.items;
|
||||
if(items) {
|
||||
var type = items.type;
|
||||
if(items.type) {
|
||||
this.type = typeFromJsonSchema(type.type, type.format);
|
||||
}
|
||||
else {
|
||||
this.ref = items['$ref'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArrayModel.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result;
|
||||
modelsToIgnore = (modelsToIgnore||{})
|
||||
if(this.type) {
|
||||
result = type;
|
||||
}
|
||||
else if (this.ref) {
|
||||
var name = simpleRef(this.ref);
|
||||
result = models[name].createJSONSample();
|
||||
}
|
||||
return [ result ];
|
||||
};
|
||||
|
||||
ArrayModel.prototype.getSampleValue = function(modelsToIgnore) {
|
||||
var result;
|
||||
modelsToIgnore = (modelsToIgnore || {})
|
||||
if(this.type) {
|
||||
result = type;
|
||||
}
|
||||
else if (this.ref) {
|
||||
var name = simpleRef(this.ref);
|
||||
result = models[name].getSampleValue(modelsToIgnore);
|
||||
}
|
||||
return [ result ];
|
||||
}
|
||||
|
||||
ArrayModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var propertiesStr = [];
|
||||
|
||||
if(this.ref) {
|
||||
return models[simpleRef(this.ref)].getMockSignature();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* SwaggerAuthorizations applys the correct authorization to an operation being executed
|
||||
@@ -177,7 +233,58 @@ Object.keys = Object.keys || (function () {
|
||||
return result;
|
||||
};
|
||||
})();
|
||||
var SwaggerClient = function(url, options) {
|
||||
/**
|
||||
* PrimitiveModel
|
||||
**/
|
||||
var PrimitiveModel = function(definition) {
|
||||
this.name = "name";
|
||||
this.definition = definition || {};
|
||||
this.properties = [];
|
||||
this.type;
|
||||
|
||||
var requiredFields = definition.enum || [];
|
||||
this.type = typeFromJsonSchema(definition.type, definition.format);
|
||||
}
|
||||
|
||||
PrimitiveModel.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result = this.type;
|
||||
return result;
|
||||
};
|
||||
|
||||
PrimitiveModel.prototype.getSampleValue = function() {
|
||||
var result = this.type;
|
||||
return null;
|
||||
}
|
||||
|
||||
PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var propertiesStr = [];
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
var prop = this.properties[i];
|
||||
propertiesStr.push(prop.toString());
|
||||
}
|
||||
|
||||
var strong = '<span class="strong">';
|
||||
var stronger = '<span class="stronger">';
|
||||
var strongClose = '</span>';
|
||||
var classOpen = strong + this.name + ' {' + strongClose;
|
||||
var classClose = strong + '}' + strongClose;
|
||||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
||||
|
||||
if (!modelsToIgnore)
|
||||
modelsToIgnore = {};
|
||||
modelsToIgnore[this.name] = this;
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
var prop = this.properties[i];
|
||||
var ref = prop['$ref'];
|
||||
var model = models[ref];
|
||||
if (model && typeof modelsToIgnore[ref] === 'undefined') {
|
||||
returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
};var SwaggerClient = function(url, options) {
|
||||
this.isBuilt = false;
|
||||
this.url = null;
|
||||
this.debug = false;
|
||||
@@ -237,7 +344,7 @@ SwaggerClient.prototype.build = function() {
|
||||
var responseObj = resp.obj || JSON.parse(resp.data);
|
||||
self.swaggerVersion = responseObj.swaggerVersion;
|
||||
|
||||
if(responseObj.swagger && responseObj.swagger === 2.0) {
|
||||
if(responseObj.swagger && parseInt(responseObj.swagger) === 2) {
|
||||
self.swaggerVersion = responseObj.swagger;
|
||||
self.buildFromSpec(responseObj);
|
||||
self.isValid = true;
|
||||
@@ -251,9 +358,7 @@ SwaggerClient.prototype.build = function() {
|
||||
};
|
||||
if(this.spec) {
|
||||
var self = this;
|
||||
setTimeout(function() {
|
||||
self.buildFromSpec(self.spec);
|
||||
}, 10);
|
||||
setTimeout(function() { self.buildFromSpec(self.spec); }, 10);
|
||||
}
|
||||
else {
|
||||
var e = (typeof window !== 'undefined' ? window : exports);
|
||||
@@ -265,8 +370,8 @@ SwaggerClient.prototype.build = function() {
|
||||
};
|
||||
|
||||
SwaggerClient.prototype.buildFromSpec = function(response) {
|
||||
if(this.isBuilt)
|
||||
return this;
|
||||
if(this.isBuilt) return this;
|
||||
|
||||
this.info = response.info || {};
|
||||
this.title = response.title || '';
|
||||
this.host = response.host || '';
|
||||
@@ -333,7 +438,7 @@ SwaggerClient.prototype.buildFromSpec = function(response) {
|
||||
|
||||
// legacy UI feature
|
||||
var j;
|
||||
var api = null;
|
||||
var api;
|
||||
for(j = 0; j < this.apisArray.length; j++) {
|
||||
if(this.apisArray[j].tag === tag) {
|
||||
api = this.apisArray[j];
|
||||
@@ -426,7 +531,10 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition
|
||||
for(i = 0; i < this.parameters.length; i++) {
|
||||
var param = this.parameters[i];
|
||||
type = this.getType(param);
|
||||
|
||||
if(type.toLowerCase() === 'boolean') {
|
||||
param.allowableValues = {};
|
||||
param.allowableValues.values = ["true", "false"];
|
||||
}
|
||||
param.signature = this.getSignature(type, models);
|
||||
param.sampleJSON = this.getSampleJSON(type, models);
|
||||
param.responseClassSignature = param.signature;
|
||||
@@ -577,14 +685,16 @@ Operation.prototype.getSignature = function(type, models) {
|
||||
if (isPrimitive) {
|
||||
return type;
|
||||
} else {
|
||||
if (listType != null) {
|
||||
if (listType != null)
|
||||
return models[type].getMockSignature();
|
||||
} else {
|
||||
else
|
||||
return models[type].getMockSignature();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* gets sample response for a single operation
|
||||
**/
|
||||
Operation.prototype.getSampleJSON = function(type, models) {
|
||||
var isPrimitive, listType, sampleJson;
|
||||
|
||||
@@ -613,11 +723,16 @@ Operation.prototype.getSampleJSON = function(type, models) {
|
||||
}
|
||||
};
|
||||
|
||||
// legacy support
|
||||
/**
|
||||
* legacy binding
|
||||
**/
|
||||
Operation.prototype["do"] = function(args, opts, callback, error, parent) {
|
||||
return this.execute(args, opts, callback, error, parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* executes an operation
|
||||
**/
|
||||
Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
var args = (arg1||{});
|
||||
var opts = {}, success, error;
|
||||
@@ -640,8 +755,9 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
|
||||
var requiredParams = [];
|
||||
var missingParams = [];
|
||||
// check required params
|
||||
for(var i = 0; i < this.parameters.length; i++) {
|
||||
// check required params, track the ones that are missing
|
||||
var i;
|
||||
for(i = 0; i < this.parameters.length; i++) {
|
||||
var param = this.parameters[i];
|
||||
if(param.required === true) {
|
||||
requiredParams.push(param.name);
|
||||
@@ -688,10 +804,25 @@ Operation.prototype.execute = function(arg1, arg2, arg3, arg4, parent) {
|
||||
}
|
||||
else if (param.in === 'header')
|
||||
headers[param.name] = args[param.name];
|
||||
else if (param.in === 'form')
|
||||
else if (param.in === 'formData')
|
||||
formParams[param.name] = args[param.name];
|
||||
}
|
||||
}
|
||||
// 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'){
|
||||
if(encoded !== "")
|
||||
encoded += "&";
|
||||
encoded += encodeURIComponent(key) + '=' + encodeURIComponent(value);
|
||||
}
|
||||
}
|
||||
// todo append?
|
||||
args.body = encoded;
|
||||
}
|
||||
var scheme = this.schemes[0];
|
||||
var url = scheme + '://' + this.host + this.basePath + requestUrl + querystring;
|
||||
|
||||
@@ -729,7 +860,7 @@ Operation.prototype.setContentTypes = function(args, opts) {
|
||||
var i;
|
||||
for(i = 0; i < allDefinedParams.length; i++) {
|
||||
var param = allDefinedParams[i];
|
||||
if(param.in === 'form')
|
||||
if(param.in === 'formData')
|
||||
definedFormParams.push(param);
|
||||
else if(param.in === 'file')
|
||||
definedFileParams.push(param);
|
||||
@@ -788,19 +919,45 @@ Operation.prototype.setContentTypes = function(args, opts) {
|
||||
Operation.prototype.encodeCollection = function(type, name, value) {
|
||||
var encoded = '';
|
||||
var i;
|
||||
if(type === 'jaxrs') {
|
||||
if(type === 'default' || type === 'multi') {
|
||||
for(i = 0; i < value.length; i++) {
|
||||
if(i > 0) encoded += '&'
|
||||
encoded += this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
|
||||
}
|
||||
}
|
||||
else {
|
||||
var separator = '';
|
||||
if(type === 'csv')
|
||||
separator = ',';
|
||||
else if(type === 'ssv')
|
||||
separator = '%20';
|
||||
else if(type === 'tsv')
|
||||
separator = '\\t';
|
||||
else if(type === 'pipes')
|
||||
separator = '|';
|
||||
if(separator !== '') {
|
||||
for(i = 0; i < value.length; i++) {
|
||||
if(i == 0)
|
||||
encoded = this.encodeQueryParam(name) + '=' + this.encodeQueryParam(value[i]);
|
||||
else
|
||||
encoded += separator + this.encodeQueryParam(value[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
// TODO: support the different encoding schemes here
|
||||
return encoded;
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO this encoding needs to be changed
|
||||
**/
|
||||
Operation.prototype.encodeQueryParam = function(arg) {
|
||||
return escape(arg);
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO revisit, might not want to leave '/'
|
||||
**/
|
||||
Operation.prototype.encodePathParam = function(pathParam) {
|
||||
var encParts, part, parts, _i, _len;
|
||||
pathParam = pathParam.toString();
|
||||
@@ -817,127 +974,6 @@ Operation.prototype.encodePathParam = function(pathParam) {
|
||||
}
|
||||
};
|
||||
|
||||
Operation.prototype.encodePathParam = function(pathParam) {
|
||||
var encParts, part, parts, _i, _len;
|
||||
pathParam = pathParam.toString();
|
||||
if (pathParam.indexOf('/') === -1) {
|
||||
return encodeURIComponent(pathParam);
|
||||
} else {
|
||||
parts = pathParam.split('/');
|
||||
encParts = [];
|
||||
for (_i = 0, _len = parts.length; _i < _len; _i++) {
|
||||
part = parts[_i];
|
||||
encParts.push(encodeURIComponent(part));
|
||||
}
|
||||
return encParts.join('/');
|
||||
}
|
||||
};
|
||||
|
||||
var ArrayModel = function(definition) {
|
||||
this.name = "name";
|
||||
this.definition = definition || {};
|
||||
this.properties = [];
|
||||
this.type;
|
||||
this.ref;
|
||||
|
||||
var requiredFields = definition.enum || [];
|
||||
var items = definition.items;
|
||||
if(items) {
|
||||
var type = items.type;
|
||||
if(items.type) {
|
||||
this.type = typeFromJsonSchema(type.type, type.format);
|
||||
}
|
||||
else {
|
||||
this.ref = items['$ref'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArrayModel.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result;
|
||||
var modelsToIgnore = (modelsToIgnore||[])
|
||||
if(this.type) {
|
||||
result = type;
|
||||
}
|
||||
else if (this.ref) {
|
||||
var name = simpleRef(this.ref);
|
||||
result = models[name].createJSONSample();
|
||||
}
|
||||
return [ result ];
|
||||
};
|
||||
|
||||
ArrayModel.prototype.getSampleValue = function() {
|
||||
var result;
|
||||
var modelsToIgnore = (modelsToIgnore||[])
|
||||
if(this.type) {
|
||||
result = type;
|
||||
}
|
||||
else if (this.ref) {
|
||||
var name = simpleRef(this.ref);
|
||||
result = models[name].getSampleValue();
|
||||
}
|
||||
return [ result ];
|
||||
}
|
||||
|
||||
ArrayModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var propertiesStr = [];
|
||||
|
||||
if(this.ref) {
|
||||
return models[simpleRef(this.ref)].getMockSignature();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
var PrimitiveModel = function(definition) {
|
||||
this.name = "name";
|
||||
this.definition = definition || {};
|
||||
this.properties = [];
|
||||
this.type;
|
||||
|
||||
var requiredFields = definition.enum || [];
|
||||
this.type = typeFromJsonSchema(definition.type, definition.format);
|
||||
}
|
||||
|
||||
PrimitiveModel.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result = this.type;
|
||||
return result;
|
||||
};
|
||||
|
||||
PrimitiveModel.prototype.getSampleValue = function() {
|
||||
var result = this.type;
|
||||
return null;
|
||||
}
|
||||
|
||||
PrimitiveModel.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var propertiesStr = [];
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
var prop = this.properties[i];
|
||||
propertiesStr.push(prop.toString());
|
||||
}
|
||||
|
||||
var strong = '<span class="strong">';
|
||||
var stronger = '<span class="stronger">';
|
||||
var strongClose = '</span>';
|
||||
var classOpen = strong + this.name + ' {' + strongClose;
|
||||
var classClose = strong + '}' + strongClose;
|
||||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
||||
if (!modelsToIgnore)
|
||||
modelsToIgnore = [];
|
||||
|
||||
modelsToIgnore.push(this.name);
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
var prop = this.properties[i];
|
||||
var ref = prop['$ref'];
|
||||
var model = models[ref];
|
||||
if (model && modelsToIgnore.indexOf(ref) === -1) {
|
||||
returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
|
||||
}
|
||||
}
|
||||
return returnVal;
|
||||
};
|
||||
|
||||
var Model = function(name, definition) {
|
||||
this.name = name;
|
||||
this.definition = definition || {};
|
||||
@@ -959,22 +995,23 @@ var Model = function(name, definition) {
|
||||
|
||||
Model.prototype.createJSONSample = function(modelsToIgnore) {
|
||||
var result = {};
|
||||
var modelsToIgnore = (modelsToIgnore||[])
|
||||
modelsToIgnore.push(this.name);
|
||||
for (var i = 0; i < this.properties.length; i++) {
|
||||
modelsToIgnore = (modelsToIgnore||{})
|
||||
modelsToIgnore[this.name] = this;
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
prop = this.properties[i];
|
||||
result[prop.name] = prop.getSampleValue(modelsToIgnore);
|
||||
}
|
||||
modelsToIgnore.pop(this.name);
|
||||
delete modelsToIgnore[this.name];
|
||||
return result;
|
||||
};
|
||||
|
||||
Model.prototype.getSampleValue = function() {
|
||||
Model.prototype.getSampleValue = function(modelsToIgnore) {
|
||||
var i;
|
||||
var obj = {};
|
||||
for(i = 0; i < this.properties.length; i++ ) {
|
||||
var property = this.properties[i];
|
||||
obj[property.name] = property.sampleValue();
|
||||
obj[property.name] = property.sampleValue(false, modelsToIgnore);
|
||||
}
|
||||
return obj;
|
||||
}
|
||||
@@ -994,15 +1031,15 @@ Model.prototype.getMockSignature = function(modelsToIgnore) {
|
||||
var classClose = strong + '}' + strongClose;
|
||||
var returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
|
||||
if (!modelsToIgnore)
|
||||
modelsToIgnore = [];
|
||||
modelsToIgnore = {};
|
||||
|
||||
modelsToIgnore.push(this.name);
|
||||
modelsToIgnore[this.name] = this;
|
||||
var i;
|
||||
for (i = 0; i < this.properties.length; i++) {
|
||||
var prop = this.properties[i];
|
||||
var ref = prop['$ref'];
|
||||
var model = models[ref];
|
||||
if (model && modelsToIgnore.indexOf(ref) === -1) {
|
||||
if (model && typeof modelsToIgnore === 'undefined') {
|
||||
returnVal = returnVal + ('<br>' + model.getMockSignature(modelsToIgnore));
|
||||
}
|
||||
}
|
||||
@@ -1029,8 +1066,8 @@ var Property = function(name, obj, required) {
|
||||
this.example = obj.example || null;
|
||||
}
|
||||
|
||||
Property.prototype.getSampleValue = function () {
|
||||
return this.sampleValue(false);
|
||||
Property.prototype.getSampleValue = function (modelsToIgnore) {
|
||||
return this.sampleValue(false, modelsToIgnore);
|
||||
}
|
||||
|
||||
Property.prototype.isArray = function () {
|
||||
@@ -1043,13 +1080,14 @@ Property.prototype.isArray = function () {
|
||||
|
||||
Property.prototype.sampleValue = function(isArray, ignoredModels) {
|
||||
isArray = (isArray || this.isArray());
|
||||
ignoredModels = (ignoredModels || {})
|
||||
ignoredModels = (ignoredModels || {});
|
||||
var type = getStringSignature(this.obj);
|
||||
var output;
|
||||
|
||||
if(this['$ref']) {
|
||||
var refModel = models[this['$ref']];
|
||||
if(refModel && typeof ignoredModels[refModel] === 'undefined') {
|
||||
if(refModel && typeof ignoredModels[type] === 'undefined') {
|
||||
ignoredModels[type] = this;
|
||||
output = refModel.getSampleValue(ignoredModels);
|
||||
}
|
||||
else
|
||||
@@ -1057,31 +1095,27 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) {
|
||||
}
|
||||
else if(this.example)
|
||||
output = this.example;
|
||||
else if(type === 'date-time') {
|
||||
else if(type === 'date-time')
|
||||
output = new Date().toISOString();
|
||||
}
|
||||
else if(type === 'string') {
|
||||
else if(type === 'string')
|
||||
output = 'string';
|
||||
}
|
||||
else if(type === 'integer') {
|
||||
else if(type === 'integer')
|
||||
output = 0;
|
||||
}
|
||||
else if(type === 'long') {
|
||||
else if(type === 'long')
|
||||
output = 0;
|
||||
}
|
||||
else if(type === 'float') {
|
||||
else if(type === 'float')
|
||||
output = 0.0;
|
||||
}
|
||||
else if(type === 'double') {
|
||||
else if(type === 'double')
|
||||
output = 0.0;
|
||||
}
|
||||
else if(type === 'boolean') {
|
||||
else if(type === 'boolean')
|
||||
output = true;
|
||||
}
|
||||
else
|
||||
output = {};
|
||||
if(isArray) return [output];
|
||||
else return output;
|
||||
ignoredModels[type] = output;
|
||||
if(isArray)
|
||||
return [output];
|
||||
else
|
||||
return output;
|
||||
}
|
||||
|
||||
getStringSignature = function(obj) {
|
||||
@@ -1161,7 +1195,9 @@ e.authorizations = new SwaggerAuthorizations();
|
||||
e.ApiKeyAuthorization = ApiKeyAuthorization;
|
||||
e.PasswordAuthorization = PasswordAuthorization;
|
||||
e.CookieAuthorization = CookieAuthorization;
|
||||
e.SwaggerClient = SwaggerClient;/**
|
||||
e.SwaggerClient = SwaggerClient;
|
||||
|
||||
/**
|
||||
* SwaggerHttp is a wrapper for executing requests
|
||||
*/
|
||||
var SwaggerHttp = function() {};
|
||||
@@ -1295,7 +1331,7 @@ var ShredHttpClient = function(options) {
|
||||
}
|
||||
else
|
||||
this.Shred = require("shred");
|
||||
this.shred = new this.Shred();
|
||||
this.shred = new this.Shred(options);
|
||||
}
|
||||
|
||||
ShredHttpClient.prototype.initShred = function () {
|
||||
|
||||
@@ -975,9 +975,22 @@
|
||||
var param = params[i];
|
||||
if (param.paramType === 'query') {
|
||||
if (args[param.name] !== undefined) {
|
||||
var value = args[param.name];
|
||||
if (queryParams !== '')
|
||||
queryParams += "&";
|
||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||
queryParams += '&';
|
||||
if (Array.isArray(value)) {
|
||||
var j;
|
||||
var output = '';
|
||||
for(j = 0; j < value.length; j++) {
|
||||
if(j > 0)
|
||||
output += ',';
|
||||
output += encodeURIComponent(value[j]);
|
||||
}
|
||||
queryParams += encodeURIComponent(param.name) + '=' + output;
|
||||
}
|
||||
else {
|
||||
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +266,7 @@ class OperationView extends Backbone.View
|
||||
options = []
|
||||
options.push opt.value for opt in select.options when opt.selected
|
||||
if options.length > 0
|
||||
options.join ","
|
||||
options
|
||||
else
|
||||
null
|
||||
|
||||
|
||||
Reference in New Issue
Block a user