-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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][resttemplate] Object with additionalProperties (HashMap) does not generate a model #3602
Comments
👍 Thanks for opening this issue! The team will review the labels and make any necessary changes. |
Can you please switch to a newer version of OpenAPI generator? Can you provide a small OpenAPI-Spec that show what is not working for you? |
@jmini I just tried with 4.1.0 same results, as well as with the 4.2 snapshot. Here is what I'm referring to. Currently I'm using a 2.0 spec, and swagger-codegen 2.3.1 and it generates ContextHeaders.java.
However, when using the 3.0 spec, it still creates a
|
I think that with See: #472 |
Thanks, that does look like the solution! However it does not create the object correctly when referenced, And in the RulesUser class it has:
So it's trying to instantiate it as a |
We have just encountered the same behaviour as @Na3blis. The problem is that, while I'll try to fix it. |
@Na3blis did you get the answer why ContextHeaders object created with HashMap and how can we fix this |
Unfortunately not. I think I ended up having to change the api to work around this |
Description
I am trying to generate a HashMap class, but no class is generated and a plain Java Map is used where the class
ContextHeaders
should be used.openapi-generator version
4.0.3
OpenAPI declaration file content or url
swagger.json
swagger-client-config.json
Command line used for generation
curl -s -o ./codegen.jar http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/4.0.3/openapi-generator-cli-4.0.3.jar
java -jar ./codegen.jar generate -c ./swagger-client-config.json -i ./swagger.json -g java -o generated-client/
Steps to reproduce
Run the codegen 4.0.3 against the swagger.json file with the config swagger-client-config.json. Notice there is no
com.example.authrules.v1.client.model.ContextHeaders
class, andcom.example.authrules.v1.client.model.RulesUser
references a plain Java Map instead of a classThe text was updated successfully, but these errors were encountered: