Description
Since 1.0.53, the generated Java code for oneOf schemas is broken when the schema contains primitive types. Previously, the resulting property had the type Object, which works fine. Now, an empty interface with no subclasses is created, breaking existing clients.
Workaround: Remove oneOf specification to force the generator to just use Object again. If there's any other workaround, please let me know.
Version
1.0.59
Can you identify when the issue first appeared?
Since this commit: 6d56f7e
Language / Generator Affected
Java
OpenAPI/Swagger Spec
"ConstantInput" : {
"required" : [ "constant" ],
"type" : "object",
"properties" : {
"constant" : {
"type" : "object",
"oneOf" : [ {
"type" : "string"
}, {
"type" : "integer",
"format" : "int32"
}, {
"type" : "number",
"format" : "double"
}, {
"type" : "boolean"
}, {
"type" : "string",
"format" : "uuid"
} ]
},
},
},
Expected Behavior
On older versions, it generated a field like this:
public class ConstantInput {
@JsonProperty("constant")
private Object constant = null;
Actual Behavior
Now, it creates this instead:
public class ConstantInput {
@JsonProperty("constant")
private OneOfConstantInputConstant constant = null;
and this unusable interface:
@JsonTypeInfo(
use = JsonTypeInfo.Id.NAME,
include = JsonTypeInfo.As.PROPERTY,
property = "")
@JsonSubTypes({
})
public interface OneOfConstantInputConstant {
}
Checklist
Description
Since 1.0.53, the generated Java code for
oneOfschemas is broken when the schema contains primitive types. Previously, the resulting property had the typeObject, which works fine. Now, an empty interface with no subclasses is created, breaking existing clients.Workaround: Remove oneOf specification to force the generator to just use
Objectagain. If there's any other workaround, please let me know.Version
1.0.59
Can you identify when the issue first appeared?
Since this commit: 6d56f7e
Language / Generator Affected
Java
OpenAPI/Swagger Spec
Expected Behavior
On older versions, it generated a field like this:
Actual Behavior
Now, it creates this instead:
and this unusable interface:
Checklist