mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-10 19:06:34 +03:00
feat: new option sortEnumValuesAlphabetically (#1321)
This commit is contained in:
parent
4db5bc470b
commit
a96a11a4dc
|
@ -12,6 +12,7 @@ export interface RedocRawOptions {
|
|||
expandResponses?: string | 'all';
|
||||
requiredPropsFirst?: boolean | string;
|
||||
sortPropsAlphabetically?: boolean | string;
|
||||
sortEnumValuesAlphabetically?: boolean | string;
|
||||
noAutoAuth?: boolean | string;
|
||||
nativeScrollbars?: boolean | string;
|
||||
pathInMiddlePanel?: boolean | string;
|
||||
|
@ -154,6 +155,7 @@ export class RedocNormalizedOptions {
|
|||
expandResponses: { [code: string]: boolean } | 'all';
|
||||
requiredPropsFirst: boolean;
|
||||
sortPropsAlphabetically: boolean;
|
||||
sortEnumValuesAlphabetically: boolean;
|
||||
noAutoAuth: boolean;
|
||||
nativeScrollbars: boolean;
|
||||
pathInMiddlePanel: boolean;
|
||||
|
@ -205,6 +207,7 @@ export class RedocNormalizedOptions {
|
|||
this.expandResponses = RedocNormalizedOptions.normalizeExpandResponses(raw.expandResponses);
|
||||
this.requiredPropsFirst = argValueToBoolean(raw.requiredPropsFirst);
|
||||
this.sortPropsAlphabetically = argValueToBoolean(raw.sortPropsAlphabetically);
|
||||
this.sortEnumValuesAlphabetically = argValueToBoolean(raw.sortEnumValuesAlphabetically);
|
||||
this.noAutoAuth = argValueToBoolean(raw.noAutoAuth);
|
||||
this.nativeScrollbars = argValueToBoolean(raw.nativeScrollbars);
|
||||
this.pathInMiddlePanel = argValueToBoolean(raw.pathInMiddlePanel);
|
||||
|
|
|
@ -168,6 +168,10 @@ export class SchemaModel {
|
|||
this.enum = this.items.enum;
|
||||
}
|
||||
}
|
||||
|
||||
if (this.enum.length && this.options.sortEnumValuesAlphabetically) {
|
||||
this.enum.sort();
|
||||
}
|
||||
}
|
||||
|
||||
private initOneOf(oneOf: OpenAPISchema[], parser: OpenAPIParser) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user