-
-
Notifications
You must be signed in to change notification settings - Fork 334
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
Generate true Typescript enums #1153
Comments
Thanks for pointing this out. This option is apparently not enabled by default (I'm using CLI), and is not documented on the main web site. |
PR for documentation update would be great! cc @soartec-lab |
There is still a bug related to the way the x-enumNames is used. It ends up generating enums with colons (Color2) instead of equals: export enum Color2 {
black: 0,
white: 10,
red: 20,
green: 30,
blue: 40,
}
export enum Color1 {
black= 'black',
white= 'white',
red= 'red',
green= 'green',
blue= 'blue',
} |
PR welcome |
Cc @dsthode who made this change. |
Thank you for sharing this issue. I will also check the PR. looking forward to it 🙌 |
The fix appears to be a one-liner, but I'm not familiar with this project - I don't know how to build it. packages/core/src/getters/enum.ts, line 93 should be ` ${keyword.isIdentifierNameES5(name) ? name : `'${name}'`}= ${val},\n` |
@soartec-lab are you submitting this PR or is @rnm-sxm ? |
No, I haven't started yet. If you don't, I can also respond to this next to the other responses. |
I can move forward with this response once the current response is finished, but out of respect for @rnm-sxm who reported the issue, I'll wait for a moment for a response 👍 |
OK I assigned to both of you and you guys can work it out! |
@soartec-lab Thanks for taking this over. |
Orval does not generate true Typescript enums. Instead it generates const object with a set of readonly keys/values
What are the steps to reproduce this issue?
What happens?
The generated typescript includes these two enums:
What were you expecting to happen?
Typescript Enums should be generated:
Any logs, error output, etc?
none.
Any other comments?
none.
What versions are you using?
Operating System: Xubuntu 22.04
Package Version: "orval": "^6.23.0"
Browser Version: N/A
The text was updated successfully, but these errors were encountered: