I'm attempting to use the 37.2.json spec to generate java objects via openapi-generator-cli-6.6.0 running under JDK11 and the resulting maven project won't build due to errors related to the "type" variable derived from the spec. I was seeing this same issue when using the 37.0 spec as well.
In short, it appears that "type" and "_type" in the generated VcloudQueryResultRecordType class conflict. Specifically:
public static final String SERIALIZED_NAME_TYPE = "type";
@SerializedName(SERIALIZED_NAME_TYPE) private String type;
public static final String SERIALIZED_NAME_TYPE = "_type";
@SerializedName(SERIALIZED_NAME_TYPE) protected String type;
Which results in these 3 methods being duplicated in VcloudQueryResultRecordType (once for "type" and once for "_type"):
public VcloudQueryResultRecordType type(String type) {
this.type = type;
return this;
}
/**
* Contains the type of the resource.
* @return type
**/
@javax.annotation.Nullable
public String getType() {
return type;
}
public void setType(String type) { this.type = type; }
public VcloudQueryResultRecordType link(List<VcloudLinkType> link) {
this.link = link;
return this;
This in-turn throws off any other generated VcloudQueryResult* classes which descend from VcloudQueryResultRecordType.
From what I can tell, the "_type" discriminator is the root of my problems (from the spec):
"vcloud_QueryResultRecordType": {
"title": "vcloud_QueryResultRecordType",
"description": "Base type for a single record from query result in records format. Subtypes define more specific elements.",
"discriminator": {
"propertyName": "_type",
Is there a particular option I need to provide to openapi-generator-cli-6.6.0 to generate better/compiling Java? I've attempted with various combinations of discriminatorCaseSensitive, legacyDiscriminatorBehavior, x-discriminator-value, etc - but none of those appear to make any difference in the generated output. Perhaps I'm looking in the wrong place WRT the discriminator value?
Thanks in advance.
I'm attempting to use the 37.2.json spec to generate java objects via
openapi-generator-cli-6.6.0running under JDK11 and the resulting maven project won't build due to errors related to the "type" variable derived from the spec. I was seeing this same issue when using the 37.0 spec as well.In short, it appears that "type" and "_type" in the generated VcloudQueryResultRecordType class conflict. Specifically:
Which results in these 3 methods being duplicated in VcloudQueryResultRecordType (once for "type" and once for "_type"):
This in-turn throws off any other generated VcloudQueryResult* classes which descend from VcloudQueryResultRecordType.
From what I can tell, the "_type" discriminator is the root of my problems (from the spec):
Is there a particular option I need to provide to
openapi-generator-cli-6.6.0to generate better/compiling Java? I've attempted with various combinations ofdiscriminatorCaseSensitive,legacyDiscriminatorBehavior,x-discriminator-value, etc - but none of those appear to make any difference in the generated output. Perhaps I'm looking in the wrong place WRT the discriminator value?Thanks in advance.