fixed responseMessages issue per #267

This commit is contained in:
Tony Tam
2013-08-19 11:40:03 -07:00
parent 888db09fd8
commit 085cc05cc7
6 changed files with 45 additions and 20 deletions

25
dist/lib/swagger.js vendored
View File

@@ -669,7 +669,7 @@
};
SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
var key, param, params, possibleParams, req, requestContentType, responseContentType, value;
var key, param, params, possibleParams, req, requestContentType, responseContentType, value, _i, _len, _ref;
if (args == null) {
args = {};
}
@@ -705,20 +705,30 @@
};
}
params = {};
params.headers = [];
if (args.headers != null) {
params.headers = args.headers;
delete args.headers;
}
_ref = this.parameters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
param = _ref[_i];
if (param.paramType === "header") {
if (args[param.name]) {
params.headers[param.name] = args[param.name];
}
}
}
if (args.body != null) {
params.body = args.body;
delete args.body;
}
possibleParams = (function() {
var _i, _len, _ref, _results;
_ref = this.parameters;
var _j, _len1, _ref1, _results;
_ref1 = this.parameters;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
param = _ref[_i];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
param = _ref1[_j];
if (param.paramType === "form" || param.paramType.toLowerCase() === "file") {
_results.push(param);
}
@@ -839,7 +849,7 @@
SwaggerRequest = (function() {
function SwaggerRequest(type, url, params, opts, successCallback, errorCallback, operation, execution) {
var body, e, fields, headers, key, myHeaders, obj, param, parent, possibleParams, requestContentType, responseContentType, urlEncoded, value, values,
var body, e, fields, headers, key, myHeaders, name, obj, param, parent, possibleParams, requestContentType, responseContentType, urlEncoded, value, values,
_this = this;
this.type = type;
this.url = url;
@@ -962,6 +972,9 @@
}
body = urlEncoded;
}
for (name in headers) {
myHeaders[name] = headers[name];
}
if (requestContentType) {
myHeaders["Content-Type"] = requestContentType;
}

8
dist/swagger-ui.js vendored
View File

@@ -461,7 +461,7 @@ function program11(depth0,data) {
stack1 = helpers['if'].call(depth0, depth0.parameters, {hash:{},inverse:self.noop,fn:self.program(5, program5, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n ";
stack1 = helpers['if'].call(depth0, depth0.errorResponses, {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
stack1 = helpers['if'].call(depth0, depth0.responseMessages, {hash:{},inverse:self.noop,fn:self.program(7, program7, data),data:data});
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "\n ";
stack1 = helpers['if'].call(depth0, depth0.isReadOnly, {hash:{},inverse:self.program(11, program11, data),fn:self.program(9, program9, data),data:data});
@@ -1134,10 +1134,10 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
else { stack1 = depth0.code; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
buffer += escapeExpression(stack1)
+ "</td>\n<td>";
if (stack1 = helpers.reason) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.reason; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if (stack1 = helpers.message) { stack1 = stack1.call(depth0, {hash:{},data:data}); }
else { stack1 = depth0.message; stack1 = typeof stack1 === functionType ? stack1.apply(depth0) : stack1; }
if(stack1 || stack1 === 0) { buffer += stack1; }
buffer += "</td>\n\n";
buffer += "</td>\n";
return buffer;
});
})();

File diff suppressed because one or more lines are too long

View File

@@ -669,7 +669,7 @@
};
SwaggerOperation.prototype["do"] = function(args, opts, callback, error) {
var key, param, params, possibleParams, req, requestContentType, responseContentType, value;
var key, param, params, possibleParams, req, requestContentType, responseContentType, value, _i, _len, _ref;
if (args == null) {
args = {};
}
@@ -705,20 +705,30 @@
};
}
params = {};
params.headers = [];
if (args.headers != null) {
params.headers = args.headers;
delete args.headers;
}
_ref = this.parameters;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
param = _ref[_i];
if (param.paramType === "header") {
if (args[param.name]) {
params.headers[param.name] = args[param.name];
}
}
}
if (args.body != null) {
params.body = args.body;
delete args.body;
}
possibleParams = (function() {
var _i, _len, _ref, _results;
_ref = this.parameters;
var _j, _len1, _ref1, _results;
_ref1 = this.parameters;
_results = [];
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
param = _ref[_i];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
param = _ref1[_j];
if (param.paramType === "form" || param.paramType.toLowerCase() === "file") {
_results.push(param);
}
@@ -839,7 +849,7 @@
SwaggerRequest = (function() {
function SwaggerRequest(type, url, params, opts, successCallback, errorCallback, operation, execution) {
var body, e, fields, headers, key, myHeaders, obj, param, parent, possibleParams, requestContentType, responseContentType, urlEncoded, value, values,
var body, e, fields, headers, key, myHeaders, name, obj, param, parent, possibleParams, requestContentType, responseContentType, urlEncoded, value, values,
_this = this;
this.type = type;
this.url = url;
@@ -962,6 +972,9 @@
}
body = urlEncoded;
}
for (name in headers) {
myHeaders[name] = headers[name];
}
if (requestContentType) {
myHeaders["Content-Type"] = requestContentType;
}

View File

@@ -46,7 +46,7 @@
</tbody>
</table>
{{/if}}
{{#if errorResponses}}
{{#if responseMessages}}
<div style='margin:0;padding:0;display:inline'></div>
<h4>Error Status Codes</h4>
<table class='fullwidth'>

View File

@@ -1,3 +1,2 @@
<td width='15%' class='code'>{{code}}</td>
<td>{{{reason}}}</td>
<td>{{{message}}}</td>