-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Description
I just attempted to use allOf in my project to use inheritance in our data model.
openapi-generator version
I am using the Maven plugin: openapi-generator-maven-plugin:4.0.0-beta2
OpenAPI declaration file
UserSpecificService:
type: object
required:
- typ
- aktiviert
properties:
id:
type: string
format: int64
typ:
$ref: '#/components/schemas/ServiceTyp'
aktiv:
type: boolean
PushServiceETA:
allOf:
- $ref: '#/components/schemas/UserSpecificService'
- type: object
properties:
verteilerListe:
type: array
items:
$ref: '#/components/schemas/PushVerteilerETA'
ort:
$ref: '#/components/schemas/Ort'
Result
public class UserSpecificService {
private String id;
private ServiceTyp typ;
private Boolean aktiv;
}
public class PushServiceETA {
private String id;
private ServiceTyp typ;
private Boolean aktiv;
private List<PushVerteilerETA> verteilerListe = new ArrayList<>();
private Ort ort = null;
}
Suggest a fix/enhancement
The Java generator should support single inheritance. It would give us way more flexibilty in the usage of the generated classes in our code.
public class PushServiceETA extends UserSpecificService {
private List<PushVerteilerETA> verteilerListe = new ArrayList<>();
private Ort ort = null;
}
Reactions are currently unavailable