-
-
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] Referencing Object with additionalProperties fails to compile with incorrect default value #5920
Closed
5 of 6 tasks
Labels
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Workaround is to post process the file: find build/open-api-generated/src/main/java/ -type f -name "*.java" -exec sed -i 's/TypeContainingAdditionalProps foo = new HashMap<>/TypeContainingAdditionalProps foo = new TypeContainingAdditionalProps/g' {} \; |
5 tasks
I've opened #6052 to resolve this. |
This was referenced Oct 27, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report Checklist
Description
Using the Java generator, the generated Model for an Object that references another Object that has "additionalProperties" fails to compile.
This is because the default value of the property is not correctly set, see in generated Bar.java:
openapi-generator version
4.3.0
Bug has already been reported for versions 4.0.0 to 4.0.3 in #3456
OpenAPI declaration file content or url
https://gist.github.com/thomas-bc/549582b87073b8e02971fb623e30cabc
Snippet:
Command line used for generation
$ java -jar ./openapi-generator-cli-4.3.0.jar generate -g java -i ./swagger.yaml -o ./generated_example
Steps to reproduce
./gradlew assemble
This will throw a compiling error:
Expected generation
private Foo foo = new Foo();
or no default value:
private Foo foo;
Related issues/PRs
#3456
The text was updated successfully, but these errors were encountered: