-
-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add typescript.exportInlineEnums option
- Loading branch information
Showing
27 changed files
with
376 additions
and
24 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,27 @@ | ||
--- | ||
'@hey-api/openapi-ts': minor | ||
--- | ||
|
||
feat: add typescript.exportInlineEnums option | ||
|
||
### Added `typescript.exportInlineEnums` option | ||
|
||
By default, inline enums (enums not defined as reusable components in the input file) will be generated only as inlined union types. You can set `exportInlineEnums` to `true` to treat inline enums as reusable components. When `true`, the exported enums will follow the style defined in `enums`. | ||
|
||
This is a breaking change since in the previous versions, inline enums were always treated as reusable components. To preserve your current output, set `exportInlineEnums` to `true`. This feature works only with the experimental parser. | ||
|
||
```js | ||
export default { | ||
client: '@hey-api/client-fetch', | ||
experimentalParser: true, | ||
input: 'path/to/openapi.json', | ||
output: 'src/client', | ||
plugins: [ | ||
// ...other plugins | ||
{ | ||
exportInlineEnums: true, // [!code ++] | ||
name: '@hey-api/typescript', | ||
}, | ||
], | ||
}; | ||
``` |
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.