[JAVA] generate a wrong class using inheritence and discriminator
Description
Given this config:
riskObject:
type: object
discriminator:
propertyName: riskType
properties:
riskType:
type: string
classOne:
type: object
allOff:
- $ref: ''#/components/schemas/riskObject'
......
After Generating a class with prefix "Api" the result is:
`@Validated @javax.annotation.Generated(value = "org.openapitools.codegen.languages.SpringCodegen", date = "2019-01-30T15:17:33.825+01:00[Europe/Paris]") @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type", visible = true ) @JsonSubTypes({ @JsonSubTypes.Type(value = **classRiskOne.class**, name = "classRiskOne") })`
this result is wrong. i excpet **ApiClassRiskOne.class**, this is wok fin with generator version **3.1.2** but there is a regression since version **3.2.0**
in pom conf
modelNamePrefix>Api</modelNamePrefix>
is ignored for inheritence
openapi-generator version
Since 3.2.0
@nabil86 can you try the following instead (without type:object)?
classOne:
allOff:
- $ref: ''#/components/schemas/riskType'
It does'nt work. As mentioned before if I change generator's version from 3.3.4 to 3.1.2 it generates what I want.
Possible reference with #1963
No, this Example has the correct class name @JsonSubTypes.Type(value = ### EnumerationUDF.class, name = "EnumerationUDF"),
my probleme is the name class start with lower case letter This one @JsonSubTypes.Type(value = enumerationUDF.class, name = "EnumerationUDF"),
I found reason related with #1963
The in schema declared discriminator: type is not presented in response body.
Tests with Wiremock confirmed it.
[
{
"type": "BooleanUDF", // The missing type descriminator
"booleanUDFKey": {
"serial": "312415926"
},
]
FYI, there is a typo in the example. allOff should be allOf .