-
-
Notifications
You must be signed in to change notification settings - Fork 6.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
[BUG] [JAVA] Compilation error of array field in oneOf field, value of complextype is empty #18274
Comments
can you try jersey2/jersey3 instead? |
are you trying the latest master? we merged a fix recently. snapshot version can be found in project's readme |
i just tried the latest version which i downloaded from https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.5.0-SNAPSHOT/openapi-generator-cli-7.5.0-20240327.040016-66.jar Generator version: 7.5.0-SNAPSHOT |
can you please build the CLI jar based on the latest master? snapshot version has not been published due to Travis CI running out of free open source credits. |
I builded the CLI jar based on the latest master and tried again, unlucky I still got the same result. :( |
i tested with latest master:
output compiles fine (after removing |
Can I take a look at your config file? It is weird that i tried again but still get the same result, I thought there was something wrong with packaging the latest CLI, but even I download the latest jar package from https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/7.5.0-SNAPSHOT/openapi-generator-cli-7.5.0-20240403.034519-67.jar and use no more config file, I still get the same result which cause compilation error. |
this one works: can you please give it another try? |
FYI. I've filed #18281 to sync jersey2 and jersey3 templates. |
Thank you, it works finally, but it doesn’t actually solve the problem fundamentally. Using the Jersey2 framework does not guarantee that other bugs will not exist. And if I change framework from okhttp-gson to jersey2, I have to adapt aws authentication template(which only available for okhttp-gson library). |
we can plot the same fix to java okhttp-gson. here is the PR that fixes the jersey2 templates to support array in oneOf may I know if you've time to contribute a PR to apply the same fix in java okhttp-gson templates? |
Thanks for your invitation. I'm not pretty sure whether I can handle this, i think it wont be easy to resolve this problem. I can give it a try if you are not in a hurry to fix this bug(because I have a job and I don't really know how to develop this project for now). :) |
just merged #18324 to provide array type support in anyOf, oneOf, please give it a try with the snapshot version (which will be published soon as part of the CI workflow) snapshot version can be found in the project's readme. |
Bug Report Checklist
Description
A compilation error occurs in the generated code when using the oneof field.
By checking the template, we found that the corresponding complextype is empty.
As you can see from the picture below, something was missing.
openapi-generator version
7.4.0 (7.3.0 also tried)
OpenAPI declaration file content or url
Generation Details
Target Language: Java
Config.yaml:
Steps to reproduce
Related issues/PRs
Suggest a fix
I guess there may be a problem with the template or a problem with complextype processing in the children of the
oneOf
filed.the
anyof
filed probably has the same problem.The text was updated successfully, but these errors were encountered: