瀏覽代碼

updated from swagger-js

bubble
Tony Tam 10 年之前
父節點
當前提交
22c7a9672c
共有 1 個文件被更改,包括 6 次插入18 次删除
  1. +6
    -18
      lib/swagger.js

+ 6
- 18
lib/swagger.js 查看文件

@@ -498,7 +498,7 @@
} }
} }
o.nickname = this.sanitize(o.nickname); o.nickname = this.sanitize(o.nickname);
var op = new SwaggerOperation(o.nickname, resource_path, method, o.parameters, o.summary, o.notes, type, responseMessages, this, consumes, produces, o.authorizations);
var op = new SwaggerOperation(o.nickname, resource_path, method, o.parameters, o.summary, o.notes, type, responseMessages, this, consumes, produces, o.authorizations, o.deprecated);
this.operations[op.nickname] = op; this.operations[op.nickname] = op;
output.push(this.operationsArray.push(op)); output.push(this.operationsArray.push(op));
} }
@@ -691,7 +691,7 @@
return str; return str;
}; };


var SwaggerOperation = function (nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations) {
var SwaggerOperation = function (nickname, path, method, parameters, summary, notes, type, responseMessages, resource, consumes, produces, authorizations, deprecated) {
var _this = this; var _this = this;


var errors = []; var errors = [];
@@ -707,6 +707,7 @@
this.consumes = consumes; this.consumes = consumes;
this.produces = produces; this.produces = produces;
this.authorizations = authorizations; this.authorizations = authorizations;
this.deprecated = deprecated;
this["do"] = __bind(this["do"], this); this["do"] = __bind(this["do"], this);


if (errors.length > 0) { if (errors.length > 0) {
@@ -738,7 +739,7 @@
} }
param.type = type; param.type = type;


if (type.toLowerCase() === 'boolean') {
if (type && type.toLowerCase() === 'boolean') {
param.allowableValues = {}; param.allowableValues = {};
param.allowableValues.values = ["true", "false"]; param.allowableValues.values = ["true", "false"];
} }
@@ -975,22 +976,9 @@
var param = params[i]; var param = params[i];
if (param.paramType === 'query') { if (param.paramType === 'query') {
if (args[param.name] !== undefined) { if (args[param.name] !== undefined) {
var value = args[param.name];
if (queryParams !== '') if (queryParams !== '')
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]);
}
queryParams += "&";
queryParams += encodeURIComponent(param.name) + '=' + encodeURIComponent(args[param.name]);
} }
} }
} }


Loading…
取消
儲存