-
-
Notifications
You must be signed in to change notification settings - Fork 3
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
Handle duplicate enum keys #3
Conversation
Handle duplicate enums
Hey, I've tried multiple times to solve stuff like this, even doing a custom quicktype build for this, and looks like there's still conflicts 😅. Thank you so much for your PR. I'll try to test it in the following days. Are you able to link me to a recreation so I can test it faster? Or just sending the specific files works for me. |
Here's an example of my generated classes.
routes.json (modified)
|
Thanks. I thought I had that case solved already. I'm going to check if it can be solved from a lower level ( |
Can you try version of generator 0.1.7 (latest)? I think this should be fixed. If not, as a fallback, this PR can be merged. |
Just tried and it did not work.
|
Crap. What I'll do is revert the change and apply your PR. Can you check if your PR also works for lists of objects? There should be the same collision issue. |
CAn you provide an example? |
Hey sorry, I've been busy. I'll try to do it later today |
@gregorym I fixed the issue with enum names, but I'm also looking to merge something like this as a backup. Would you mind doing it so it will put numbers in case there's a repeated name only? Again, thank you for your help 🙌 |
Sure. I was going to change the logic from using a number to using use the class name instead. Having a number makes is very confusing to use the enum in your code if there's a number in it. |
Can you wait 5 minutes and try 0.1.8 for the generator? I think I fixed the enum thing, and works as you mentioned. |
Yes of course :D |
It is possible for input (or output) to expect an enum. However, when another input has an enum with the same name as a previously generated class, then the final output have multiple enums with the same name.
This PR detects generated enum and makes them unique to avoid duplicates.