-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[BUG] [JAVA] Missing imports in okhttp-gson client #14599
Comments
please provide one for easier troubleshooting. |
@wing328 Here's a (not) working example (heh): https://github.com/swanysimon/java-generator-example-14599 Updating the original comment too |
I seem to have the same missing imports. Java11 with dateLibrary=java8 |
@swanysimon if you change the spec to 3.0.2, it seems to work (there's another issue how the parameter in which int64 should be format instead) |
@stowns please provide a spec to reproduce the issue. |
ah yes @wing328 using |
My 15 lines example here: https://github.com/ole-v-v/openapi-generator-java-bug-14599-example/blob/main/test.swagger.json |
Migrating my schema yaml from swagger 2.0 -> openapi 3.0.2 didn't solve the import issue. Still missing imports for |
Have you tested with the latest master to confirm the issue still exists? Yes, I have observed the bug on master (up to commit d7edbad from Wed Feb 15 02:12:39 2023 -0500 (inclusive)). |
above PR should fix this issue of missing imports. |
In a few tests using the latest from master (up to and including commit b6b8883 from Sun May 14 23:06:20 2023 +0800 inclusive) I was unable to reproduce the bug. Thanks for fixing. |
Bug Report Checklist
Description
I'm trying to upgrade my Gradle plugin version from 5.4.0 to 6.3.0 and running into an issue with generated enum classes for my API client.
There are a number of missing imports in https://github.com/juanavilactn/openapi-generator/blob/master/modules/openapi-generator/src/main/resources/Java/libraries/okhttp-gson/pojo.mustache. This is the list I get in my IDE that I have to manually add imports for with my enums:
openapi-generator version
6.3.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Try to generate with the above with an enum object. I can work on a minimal example if it would actually be helpful, but it seems pretty straightforward.
Minimal example: https://github.com/swanysimon/java-generator-example-14599
Related issues/PRs
n/a
Suggest a fix
I can make this change myself since it is just adding imports, but this clearly made it through testing and its possible folks want a more thorough fix and/or testing.
The text was updated successfully, but these errors were encountered: