updated client, version

This commit is contained in:
Tony Tam
2015-02-09 10:22:44 -08:00
parent 002a63ce26
commit 61a87b8fd7
5 changed files with 299 additions and 245 deletions

View File

@@ -1,6 +1,6 @@
/**
* swagger-client - swagger.js is a javascript client for use with swaggering APIs.
* @version v2.1.1-M1
* @version v2.1.2-M1
* @link http://swagger.io
* @license apache 2.0
*/
@@ -578,6 +578,20 @@ var Operation = function(parent, scheme, operationId, httpMethod, path, args, de
this.description = args.description;
this.useJQuery = parent.useJQuery;
if(typeof this.deprecated === 'string') {
switch(this.deprecated.toLowerCase()) {
case 'true': case 'yes': case '1': {
this.deprecated = true;
break;
}
case 'false': case 'no': case '0': case null: {
this.deprecated = false;
break;
}
default: this.deprecated = Boolean(this.deprecated);
}
}
if(definitions) {
// add to global models
var key;
@@ -810,9 +824,7 @@ Operation.prototype.getHeaderParams = function (args) {
if (param.in === 'header') {
var value = args[param.name];
if(Array.isArray(value))
value = this.encodePathCollection(param.collectionFormat, param.name, value);
else
value = this.encodePathParam(value);
value = value.toString();
headers[param.name] = value;
}
}
@@ -1683,6 +1695,7 @@ 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;
@@ -1761,7 +1774,7 @@ SwaggerResource.prototype.addApiDeclaration = function (response) {
this.consumes = response.consumes;
if ((typeof response.basePath === 'string') && response.basePath.replace(/\s/g, '').length > 0)
this.basePath = response.basePath.indexOf('http') === -1 ? this.getAbsoluteBasePath(response.basePath) : response.basePath;
this.resourcePath = response.resourcePath;
this.addModels(response.models);
if (response.apis) {
for (var i = 0 ; i < response.apis.length; i++) {
@@ -2040,9 +2053,23 @@ var SwaggerOperation = function (nickname, path, method, parameters, summary, no
this.consumes = consumes;
this.produces = produces;
this.authorizations = typeof authorizations !== 'undefined' ? authorizations : resource.authorizations;
this.deprecated = (typeof deprecated === 'string' ? Boolean(deprecated) : deprecated);
this.deprecated = deprecated;
this['do'] = __bind(this['do'], this);
if(typeof this.deprecated === 'string') {
switch(this.deprecated.toLowerCase()) {
case 'true': case 'yes': case '1': {
this.deprecated = true;
break;
}
case 'false': case 'no': case '0': case null: {
this.deprecated = false;
break;
}
default: this.deprecated = Boolean(this.deprecated);
}
}
if (errors.length > 0) {
console.error('SwaggerOperation errors', errors, arguments);
this.resource.api.fail(errors);