updated js libs

This commit is contained in:
Tony Tam
2014-11-10 23:19:14 -08:00
parent d1d2bc75db
commit 8e20a32344
5 changed files with 113 additions and 35 deletions

View File

@@ -559,7 +559,7 @@ var Operation = function(parent, operationId, httpMethod, path, args, definition
param.allowMultiple = true;
}
var innerType = this.getType(param);
if(innerType.toString().toLowerCase() === 'boolean') {
if(innerType && innerType.toString().toLowerCase() === 'boolean') {
param.allowableValues = {};
param.isList = true;
param.enum = ["true", "false"];
@@ -1000,7 +1000,7 @@ Operation.prototype.encodeCollection = function(type, name, value) {
}
/**
* TODO this encoding needs to be changed
* TODO this encoding needs to be changed
**/
Operation.prototype.encodeQueryParam = function(arg) {
return escape(arg);
@@ -1040,7 +1040,7 @@ var Model = function(name, definition) {
if(requiredFields.indexOf(key) >= 0)
required = true;
this.properties.push(new Property(key, property, required));
}
}
}
}
@@ -1219,7 +1219,7 @@ Property.prototype.toString = function() {
str += ', <span class="propOptKey">optional</span>';
str += ')';
}
else
else
str = this.name + ' (' + JSON.stringify(this.obj) + ')';
if(typeof this.description !== 'undefined')
@@ -1483,4 +1483,4 @@ ShredHttpClient.prototype.execute = function(obj) {
obj.on = res;
}
return this.shred.request(obj);
};
};

View File

@@ -1,5 +1,5 @@
// swagger.js
// version 2.0.41
// version 2.0.42
(function () {
@@ -974,16 +974,22 @@
var queryParams = "";
for (var i = 0; i < params.length; i++) {
var param = params[i];
if (param.paramType === 'query') {
if (args[param.name] !== undefined) {
if (queryParams !== '')
queryParams += "&";
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
}
if (queryParams !== '')
queryParams += '&';
if (Array.isArray(param)) {
var j;
var output = '';
for(j = 0; j < param.length; j++) {
if(j > 0)
output += ',';
output += encodeURIComponent(param[j]);
}
queryParams += encodeURIComponent(param.name) + '=' + output;
}
else {
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
}
}
if ((queryParams != null) && queryParams.length > 0)
url += '?' + queryParams;
return url;
};
@@ -1477,8 +1483,8 @@
data: response.content.data
};
var contentType = (response._headers["content-type"] || response._headers["Content-Type"] || null)
var headers = response._headers.normalized || response._headers;
var contentType = (headers["content-type"] || headers["Content-Type"] || null)
if (contentType != null) {
if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
if (response.content.data && response.content.data !== "")