-
-
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] The client generated by version 3.3.4 hasn't properties generated as concrete Java class but as generic Object class #2366
Comments
@bednar can you try the latest master (snapshot), which has better support for inheritance? |
I tried it over public class Cat extends Pet {
public static final String SERIALIZED_NAME_HUNTS = "hunts";
@SerializedName(SERIALIZED_NAME_HUNTS)
private Boolean hunts;
public static final String SERIALIZED_NAME_AGE = "age";
@SerializedName(SERIALIZED_NAME_AGE)
private Integer age;
public static final String SERIALIZED_NAME_LINKS = "links";
@SerializedName(SERIALIZED_NAME_LINKS)
private Object links = null;
public Cat hunts(Boolean hunts) {
this.hunts = hunts;
return this;
} For self builded public class Cat extends Pet {
public static final String SERIALIZED_NAME_HUNTS = "hunts";
@SerializedName(SERIALIZED_NAME_HUNTS)
private Boolean hunts;
public static final String SERIALIZED_NAME_AGE = "age";
@SerializedName(SERIALIZED_NAME_AGE)
private Integer age;
public static final String SERIALIZED_NAME_LINKS = "links";
@SerializedName(SERIALIZED_NAME_LINKS)
private Object links = null;
public Cat hunts(Boolean hunts) {
this.hunts = hunts;
return this;
} |
This is a limitation with the inline model resolver. As a workaround, please use $ref to define the following instead of defning it inline:
|
@wing328 Thanks for your advice. Is there any other solution than rewrite the swagger definition? We use the OpenAPI Generator to generate client for the this swagger: https://github.com/influxdata/influxdb/blob/master/http/swagger.yml and the |
Let me see what we can do for you. |
Thx @wing328 We are able to write a "custom handler" or something like this (it this option is here). |
Bug Report Checklist
Description
If i generate client with version 3.0.3 the
Cat
class is:but if I generate client with version 3.3.4 than the
Cat
class is:The expected output is that the
links
is aCatLinks
class notObject
class.openapi-generator version
It is regression between 3.3.4 and 3.0.3 of the openapi-generator-maven-plugin.
OpenAPI declaration file content or url
Command line used for generation
Generate client via:
Steps to reproduce
The maven plugin configuration:
Related issues/PRs
Suggest a fix
The text was updated successfully, but these errors were encountered: