Open bednar opened 5 years ago
@bednar can you try the latest master (snapshot), which has better support for inheritance?
@wing328
I tried it over 4.0.0-beta2
and results it:
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 4.0.0-SNAPSHOT
is the result also same:
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:
links:
type: object
example:
self: "/api/v2/scrapers/1"
owners: "/api/v2/scrapers/1/owners"
members: "/api/v2/scrapers/1/members"
properties:
self:
$ref: "#/components/schemas/Link"
members:
$ref: "#/components/schemas/Link"
owners:
$ref: "#/components/schemas/Link"
@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 links
definition is pretty common.
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