apisSorter -> tagsSorter
"tags", not "tag", because it sorts the tags themselves, not the content of each tag.
This commit is contained in:
@@ -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.
|
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.
|
dom_id | The id of a dom element inside which SwaggerUi will put the user interface for swagger.
|
||||||
oauth2RedirectUrl | OAuth redirect URL
|
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.
|
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
|
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
|
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
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import * as AllPlugins from "core/plugins/all"
|
|||||||
import { parseSeach, filterConfigs } from "core/utils"
|
import { parseSeach, filterConfigs } from "core/utils"
|
||||||
|
|
||||||
const CONFIGS = [ "url", "urls", "urls.primaryName", "spec", "validatorUrl", "onComplete", "onFailure", "authorizations", "docExpansion",
|
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"]
|
"showRequestHeaders", "custom", "modelPropertyMacro", "parameterMacro", "displayOperationId" , "displayRequestDuration"]
|
||||||
|
|
||||||
// eslint-disable-next-line no-undef
|
// eslint-disable-next-line no-undef
|
||||||
|
|||||||
@@ -201,11 +201,11 @@ export const operationsWithTags = createSelector(
|
|||||||
)
|
)
|
||||||
|
|
||||||
export const taggedOperations = (state) => ({ getConfigs }) => {
|
export const taggedOperations = (state) => ({ getConfigs }) => {
|
||||||
let { apisSorter, operationsSorter } = getConfigs()
|
let { tagsSorter, operationsSorter } = getConfigs()
|
||||||
|
|
||||||
return operationsWithTags(state)
|
return operationsWithTags(state)
|
||||||
.sort((operationA, operationB) => {
|
.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))
|
return (!sortFn ? null : sortFn(operationA, operationB))
|
||||||
})
|
})
|
||||||
.map((ops, tag) => {
|
.map((ops, tag) => {
|
||||||
|
|||||||
@@ -575,7 +575,7 @@ export const sorters = {
|
|||||||
alpha: (a, b) => a.get("path").localeCompare(b.get("path")),
|
alpha: (a, b) => a.get("path").localeCompare(b.get("path")),
|
||||||
method: (a, b) => a.get("method").localeCompare(b.get("method"))
|
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]))
|
alpha: (a, b) => a.getIn([0, "operation", "tags", 0]).localeCompare(b.getIn([0, "operation", "tags", 0]))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user