Skip to content

Commit

Permalink
updated swagger-js
Browse files Browse the repository at this point in the history
  • Loading branch information
fehguy committed Dec 4, 2014
1 parent 4ec7930 commit 2c4f4a6
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
12 changes: 9 additions & 3 deletions dist/lib/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
url: this.url,
method: "get",
headers: {
accept: "application/json,application/json;charset=\"utf-8\",*/*"
accept: "application/json,application/json;charset=utf-8,*/*"
},
on: {
error: function (response) {
Expand Down Expand Up @@ -373,7 +373,7 @@
method: "get",
useJQuery: this.useJQuery,
headers: {
accept: "application/json,application/json;charset=\"utf-8\",*/*"
accept: "application/json,application/json;charset=utf-8,*/*"
},
on: {
response: function (resp) {
Expand Down Expand Up @@ -1503,7 +1503,13 @@
if (contentType != null) {
if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
if (response.content.data && response.content.data !== "")
out.obj = JSON.parse(response.content.data);
try {
out.obj = JSON.parse(response.content.data);
}
catch () {
// do not set out.obj
log ("unable to parse JSON content");
}
else
out.obj = {}
}
Expand Down
16 changes: 14 additions & 2 deletions dist/swagger-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,18 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
return this.api.build();
};

SwaggerUi.prototype.collapseAll = function() {
return Docs.collapseEndpointListForResource('');
};

SwaggerUi.prototype.listAll = function() {
return Docs.collapseOperationsForResource('');
};

SwaggerUi.prototype.expandAll = function() {
return Docs.expandOperationsForResource('');
};

SwaggerUi.prototype.render = function() {
var _this = this;
this.showMessage('Finished Loading Resource Information. Rendering Swagger UI...');
Expand All @@ -1397,10 +1409,10 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
this.showMessage();
switch (this.options.docExpansion) {
case "full":
Docs.expandOperationsForResource('');
this.expandAll();
break;
case "list":
Docs.collapseOperationsForResource('');
this.listAll();
}
if (this.options.onComplete) {
this.options.onComplete(this.api, this);
Expand Down
2 changes: 1 addition & 1 deletion dist/swagger-ui.min.js

Large diffs are not rendered by default.

12 changes: 9 additions & 3 deletions lib/swagger.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@
url: this.url,
method: "get",
headers: {
accept: "application/json,application/json;charset=\"utf-8\",*/*"
accept: "application/json,application/json;charset=utf-8,*/*"
},
on: {
error: function (response) {
Expand Down Expand Up @@ -373,7 +373,7 @@
method: "get",
useJQuery: this.useJQuery,
headers: {
accept: "application/json,application/json;charset=\"utf-8\",*/*"
accept: "application/json,application/json;charset=utf-8,*/*"
},
on: {
response: function (resp) {
Expand Down Expand Up @@ -1503,7 +1503,13 @@
if (contentType != null) {
if (contentType.indexOf("application/json") == 0 || contentType.indexOf("+json") > 0) {
if (response.content.data && response.content.data !== "")
out.obj = JSON.parse(response.content.data);
try {
out.obj = JSON.parse(response.content.data);
}
catch () {
// do not set out.obj
log ("unable to parse JSON content");
}
else
out.obj = {}
}
Expand Down

0 comments on commit 2c4f4a6

Please sign in to comment.