-
Notifications
You must be signed in to change notification settings - Fork 6k
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
[Java] Generated code does not compile when using enums in inherited models #1050
Comments
Here's a repro:
Repro output:
|
Below is how we could get rid of this issue in another way (IMHO):
With the above two steps, the issue will be gone. @who, it's cool that your PR (#1051) gets the issue fixed regardless whether the above two approaches are taken. That said, I'm not sure if it's worth the effort (although you've done it, thanks!) or we should keep it simple by using the two approaches above to avoid the issue from the beginning. |
Thanks for the feedback, @xhh
The output spec is the default output generated by swagger-core, so we'd have to modify swagger-core to remove the duplicated properties. I think this probably would be a bigger change, so it may be best to fix this from the swagger-codegen side.
Currently, |
It looks like there are two ways to fix this: prevention or post-processing. Option: Prevention Option: Post-processing |
Sorry for the typo, I meant "set supportsInheritance to |
@who @xhh i've opened #1094 to at least set |
PR is merged - closing now |
Given this spec snippet
The swagger-codegen output for java will not compile. It generates an enum for both the parent and the child class, and generates a getter&setter for each. However, this will not compile in java, because the return type of the enum getter in the subtype is not equal to the enum type in the parent class, and therefore the override is not proper.
The text was updated successfully, but these errors were encountered: