-
Notifications
You must be signed in to change notification settings - Fork 438
Open
Labels
Description
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
- I have searched the existing issues to avoid duplicates.
- I have included a minimal reproducible spec or configuration.
- I have clearly described the steps to reproduce the issue.
- [ x I have specified which generator or template is affected.