mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-06 05:10:20 +03:00
operations: Add support for sortOperationsAlphabetically
Already documented but is currently `NO-OP` and not implemented `sortOperationsAlphabetically`. Allows sorting operations in sidebar menu according to their `name` configured which is by default `summary` from Swaggerspec TLDR: Following commit adds support for `sortOperationsAlphabetically` already documented but not implemented here: https://redoc.ly/docs/api-reference-docs/guides/migration-guide-2-0/#automated-sorting Signed-off-by: flouthoc <flouthoc.git@gmail.com>
This commit is contained in:
parent
6c41e95aa0
commit
a7b75f320f
|
@ -209,6 +209,9 @@ export class MenuBuilder {
|
|||
operation.depth = depth;
|
||||
res.push(operation);
|
||||
}
|
||||
if (options.sortOperationsAlphabetically) {
|
||||
res.sort((a, b) => a.name.localeCompare(b.name));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@ export interface RedocRawOptions {
|
|||
requiredPropsFirst?: boolean | string;
|
||||
sortPropsAlphabetically?: boolean | string;
|
||||
sortEnumValuesAlphabetically?: boolean | string;
|
||||
sortOperationsAlphabetically?: boolean | string;
|
||||
noAutoAuth?: boolean | string;
|
||||
nativeScrollbars?: boolean | string;
|
||||
pathInMiddlePanel?: boolean | string;
|
||||
|
@ -203,6 +204,7 @@ export class RedocNormalizedOptions {
|
|||
requiredPropsFirst: boolean;
|
||||
sortPropsAlphabetically: boolean;
|
||||
sortEnumValuesAlphabetically: boolean;
|
||||
sortOperationsAlphabetically: boolean;
|
||||
noAutoAuth: boolean;
|
||||
nativeScrollbars: boolean;
|
||||
pathInMiddlePanel: boolean;
|
||||
|
@ -262,6 +264,7 @@ export class RedocNormalizedOptions {
|
|||
this.requiredPropsFirst = argValueToBoolean(raw.requiredPropsFirst);
|
||||
this.sortPropsAlphabetically = argValueToBoolean(raw.sortPropsAlphabetically);
|
||||
this.sortEnumValuesAlphabetically = argValueToBoolean(raw.sortEnumValuesAlphabetically);
|
||||
this.sortOperationsAlphabetically = argValueToBoolean(raw.sortOperationsAlphabetically);
|
||||
this.noAutoAuth = argValueToBoolean(raw.noAutoAuth);
|
||||
this.nativeScrollbars = argValueToBoolean(raw.nativeScrollbars);
|
||||
this.pathInMiddlePanel = argValueToBoolean(raw.pathInMiddlePanel);
|
||||
|
|
Loading…
Reference in New Issue
Block a user