Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for legacy enum #143

Closed
mlankamp opened this issue Mar 26, 2024 · 8 comments · Fixed by #147
Closed

Support for legacy enum #143

mlankamp opened this issue Mar 26, 2024 · 8 comments · Fixed by #147
Labels
feature 🚀 New feature or request

Comments

@mlankamp
Copy link
Contributor

mlankamp commented Mar 26, 2024

Describe the problem

When upgrading from openapi-typescript-codegen the handling of enum is totally different and based on the thread #60 I understand why. But this causes so large upgrade issues in our code base.

Describe the proposed solution

It would be nice to have an --useLegacyEnum flag which would use the typescript enum construct.

Alternatives considered

No response

Importance

nice to have

Additional information

No response

@mlankamp mlankamp added the feature 🚀 New feature or request label Mar 26, 2024
@mrlubos
Copy link
Member

mrlubos commented Mar 26, 2024

Hey @mlankamp, how many errors are we talking about? Are you able to use this approach to migrate your code? https://github.com/hey-api/openapi-ts?tab=readme-ov-file#useoptions-true

@mlankamp
Copy link
Contributor Author

I think we have like 100+ different enums in our code, and because the models are different between the new and old this doesn't allow us to upgrade easily

@jordanshatford
Copy link
Collaborator

@mlankamp I have released this in version 0.29.0 of @hey-api/openapi-ts.

@mlankamp
Copy link
Contributor Author

Thanks, I need to update 1 thing. The index.ts writes the enums as export type {} from ... where the type should be removed. Will send an update later today

@jordanshatford
Copy link
Collaborator

@mlankamp no need. I have made the fix #158 and will release as 0.29.1 shortly

@jordanshatford
Copy link
Collaborator

I have just released the version with the fix.

@mlankamp
Copy link
Contributor Author

I think the fix is to aggressive, nothing is export as type anymore. I created a solution also, which only targets the enums

@jordanshatford
Copy link
Collaborator

@mlankamp I have merged your change and will be releaseing 0.29.2 shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 🚀 New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants