-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[typescript-axios] Add stringEnums option (#11368)
* add stringEnums option * update templates * add export * update samples * update document * improve readability * remove unnecessary code * add config file for sample * add sample * update sample * remove enum variable form modelObjetEnum template because this variable is not used in modelStringEnum template. * change the indentation to be the same as modelGeneric template
- Loading branch information
Showing
30 changed files
with
2,664 additions
and
426 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
generatorName: typescript-axios | ||
outputDir: samples/client/petstore/typescript-axios/builds/with-string-enums | ||
inputSpec: modules/openapi-generator/src/test/resources/2_0/petstore.yaml | ||
templateDir: modules/openapi-generator/src/main/resources/typescript-axios | ||
additionalProperties: | ||
stringEnums: true |
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
14 changes: 14 additions & 0 deletions
14
modules/openapi-generator/src/main/resources/typescript-axios/modelObjectEnum.mustache
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,14 @@ | ||
export const {{classname}} = { | ||
{{#allowableValues}} | ||
{{#enumVars}} | ||
{{#enumDescription}} | ||
/** | ||
* {{.}} | ||
*/ | ||
{{/enumDescription}} | ||
{{{name}}}: {{{value}}}{{^-last}},{{/-last}} | ||
{{/enumVars}} | ||
{{/allowableValues}} | ||
} as const; | ||
|
||
export type {{classname}} = typeof {{classname}}[keyof typeof {{classname}}]; |
12 changes: 12 additions & 0 deletions
12
modules/openapi-generator/src/main/resources/typescript-axios/modelStringEnum.mustache
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,12 @@ | ||
export enum {{classname}} { | ||
{{#allowableValues}} | ||
{{#enumVars}} | ||
{{#enumDescription}} | ||
/** | ||
* {{.}} | ||
*/ | ||
{{/enumDescription}} | ||
{{{name}}} = {{{value}}}{{^-last}},{{/-last}} | ||
{{/enumVars}} | ||
{{/allowableValues}} | ||
} |
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
Oops, something went wrong.