Swagger UI: Updating swagger-ui.js to list the resources and operations

in sorted order.
This commit is contained in:
nikhiljindal
2015-01-12 17:29:07 -08:00
parent f8db96b673
commit 87c9c374b7
3 changed files with 103 additions and 29 deletions

View File

@@ -13,8 +13,9 @@ Instructions on how to use these:
https://github.com/swagger-api/swagger-ui#how-to-use-it
## Local Modifications
Updated the url to "../../swaggerapi" as per instructions at:
- Updated the url to "../../swaggerapi" as per instructions at:
https://github.com/swagger-api/swagger-ui#how-to-use-it
- Modified swagger-ui.js to list resources and operations in sorted order.
LICENSE file has been created for compliance purposes.
Not included in original distribution.

View File

@@ -1617,7 +1617,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
$(this.el).html(Handlebars.templates.main(this.model));
resources = {};
counter = 0;
_ref3 = this.model.apisArray;
_ref3 = _.sortBy(this.model.apisArray, function(resource) { return resource.name;});
for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
resource = _ref3[_i];
id = resource.name;
@@ -1679,7 +1679,9 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
if (this.model.description) {
this.model.summary = this.model.description;
}
_ref4 = this.model.operationsArray;
// Sort the operations by path and method (get/post).
_ref4 = _.sortBy(this.model.operationsArray, function(operation) { return [operation.path, operation.method];});
for (_i = 0, _len = _ref4.length; _i < _len; _i++) {
operation = _ref4[_i];
counter = 0;