From 571d65a5829e5b4d352fe126f251e045a1cef16f Mon Sep 17 00:00:00 2001 From: Kyle Shockey Date: Thu, 13 Jul 2017 20:36:08 -0700 Subject: [PATCH] apisSorter -> tagsSorter "tags", not "tag", because it sorts the tags themselves, not the content of each tag. --- README.md | 2 +- src/core/index.js | 2 +- src/core/plugins/spec/selectors.js | 4 ++-- src/core/utils.js | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index e8ab9616..d076f377 100644 --- a/README.md +++ b/README.md @@ -137,7 +137,7 @@ spec | A JSON object describing the OpenAPI Specification. When used, the `url` validatorUrl | By default, Swagger-UI attempts to validate specs against swagger.io's online validator. You can use this parameter to set a different validator URL, for example for locally deployed validators ([Validator Badge](https://github.com/swagger-api/validator-badge)). Setting it to `null` will disable validation. dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger. oauth2RedirectUrl | OAuth redirect URL -apisSorter | Apply a sort to the tag list of each API. It can be 'alpha' (sort by paths alphanumerically) or a function (see Array.prototype.sort() to know how sort function works). Default is the order determined by Swagger-UI. +tagsSorter | Apply a sort to the tag list of each API. It can be 'alpha' (sort by paths alphanumerically) or a function (see Array.prototype.sort() to know how sort function works). Default is the order determined by Swagger-UI. operationsSorter | Apply a sort to the operation list of each API. It can be 'alpha' (sort by paths alphanumerically), 'method' (sort by HTTP method) or a function (see Array.prototype.sort() to know how sort function works). Default is the order returned by the server unchanged. configUrl | Configs URL parameterMacro | MUST be a function. Function to set default value to parameters. Accepts two arguments parameterMacro(operation, parameter). Operation and parameter are objects passed for context, both remain immutable diff --git a/src/core/index.js b/src/core/index.js index 80335da5..24bf8d94 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -7,7 +7,7 @@ import * as AllPlugins from "core/plugins/all" import { parseSeach, filterConfigs } from "core/utils" const CONFIGS = [ "url", "urls", "urls.primaryName", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion", - "apisSorter", "operationsSorter", "supportedSubmitMethods", "dom_id", "defaultModelRendering", "oauth2RedirectUrl", + "tagsSorter", "operationsSorter", "supportedSubmitMethods", "dom_id", "defaultModelRendering", "oauth2RedirectUrl", "showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro", "displayOperationId" , "displayRequestDuration"] // eslint-disable-next-line no-undef diff --git a/src/core/plugins/spec/selectors.js b/src/core/plugins/spec/selectors.js index a67dc28b..c9b31cf1 100644 --- a/src/core/plugins/spec/selectors.js +++ b/src/core/plugins/spec/selectors.js @@ -201,11 +201,11 @@ export const operationsWithTags = createSelector( ) export const taggedOperations = (state) => ({ getConfigs }) => { - let { apisSorter, operationsSorter } = getConfigs() + let { tagsSorter, operationsSorter } = getConfigs() return operationsWithTags(state) .sort((operationA, operationB) => { - let sortFn = (typeof apisSorter === "function" ? apisSorter : sorters.apisSorter[ apisSorter ]) + let sortFn = (typeof tagsSorter === "function" ? tagsSorter : sorters.tagsSorter[ tagsSorter ]) return (!sortFn ? null : sortFn(operationA, operationB)) }) .map((ops, tag) => { diff --git a/src/core/utils.js b/src/core/utils.js index eb6e0a0e..f4b925f6 100644 --- a/src/core/utils.js +++ b/src/core/utils.js @@ -575,7 +575,7 @@ export const sorters = { alpha: (a, b) => a.get("path").localeCompare(b.get("path")), method: (a, b) => a.get("method").localeCompare(b.get("method")) }, - apisSorter: { + tagsSorter: { alpha: (a, b) => a.getIn([0, "operation", "tags", 0]).localeCompare(b.getIn([0, "operation", "tags", 0])) } }