-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
62 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
export interface LabelsConfig { | ||
enum: string; | ||
enumSingleValue: string; | ||
enumArray: string; | ||
default: string; | ||
deprecated: string; | ||
example: string; | ||
nullable: string; | ||
recursive: string; | ||
arrayOf: string; | ||
} | ||
|
||
export type LabelsConfigRaw = Partial<LabelsConfig>; | ||
|
||
const labels: LabelsConfig = { | ||
enum: 'Enum', | ||
enumSingleValue: 'Value', | ||
enumArray: 'Items', | ||
default: 'Default', | ||
deprecated: 'Deprecated', | ||
example: 'Example', | ||
nullable: 'Nullable', | ||
recursive: 'Recursive', | ||
arrayOf: 'Array of ', | ||
}; | ||
|
||
export function setRedocLabels(_labels?: LabelsConfigRaw) { | ||
Object.assign(labels, _labels); | ||
} | ||
|
||
export function l(key: keyof LabelsConfig, idx?: number): string { | ||
const label = labels[key]; | ||
if (idx !== undefined) { | ||
return label[idx]; | ||
} | ||
return label; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters