diff --git a/lib/index.js b/lib/index.js index 3f33e62f..a99609f0 100644 --- a/lib/index.js +++ b/lib/index.js @@ -26,7 +26,7 @@ const schema = Joi.object({ documentationPage: Joi.boolean(), swaggerUI: Joi.boolean(), expanded: Joi.string().valid(['none', 'list', 'full']), - sortTags: Joi.string().valid(['alpha', 'default']), + sortTags: Joi.string().valid(['alpha']), sortEndpoints: Joi.string().valid(['alpha', 'method', 'ordered']), sortPaths: Joi.string().valid(['unsorted', 'path-method']), uiCompleteScript: Joi.string().allow(null), diff --git a/optionsreference.md b/optionsreference.md index 6875003d..a7421be8 100644 --- a/optionsreference.md +++ b/optionsreference.md @@ -52,7 +52,7 @@ - `documentationPage`: (boolean) Add documentation page - default: `true` - `documentationPath`: (string) The path of the documentation page - default: `/documentation` - `expanded`: (string) If UI is expanded when opened. `none`, `list` or `full` - default: `list` -- `sortTags`: (string) a sort method for `tags` i.e. groups in UI. `alpha`, `default` or `name` +- `sortTags`: (string) a sort method for `tags` i.e. groups in UI. `alpha` - `alpha`: sort by paths alphanumerically - `sortEndpoints`: (string) a sort method for endpoints in UI. `alpha`, `method`, `ordered`. - `alpha`: sort by paths alphanumerically diff --git a/public/extend.js b/public/extend.js index 9da3f31a..8adcd396 100644 --- a/public/extend.js +++ b/public/extend.js @@ -1,13 +1,6 @@ // sort function for tag groups var apisSorter = { - alpha: 'alpha', - default: function(a, b) { - if (tags.indexOf(a.name) > -1 && tags.indexOf(b.name) > -1) { - if (tags.indexOf(a.name) < tags.indexOf(b.name)) return -1; - if (tags.indexOf(a.name) > tags.indexOf(b.name)) return 1; - } - return 0; - } + alpha: 'alpha' }; // sort function for api endpoints within groups diff --git a/templates/index.html b/templates/index.html index 6a7ae213..5eb4f3b0 100644 --- a/templates/index.html +++ b/templates/index.html @@ -57,11 +57,10 @@ plugins: [SwaggerUIBundle.plugins.DownloadUrl], layout: 'StandaloneLayout', docExpansion: "{{hapiSwagger.expanded}}", - apisSorter: apisSorter.{{hapiSwagger.sortTags}}, + tagsSorter: apisSorter.{{hapiSwagger.sortTags}}, operationsSorter: operationsSorter.{{hapiSwagger.sortEndpoints}}, } - // Begin Swagger UI call region var ui = SwaggerUIBundle(swaggerOptions); window.ui = ui;