I'm using open api 3.0.3 I went through the documentation and another similar question Swagger Inheritance and Composition.
But I was not successful in getting it to work.
In Java code here is what I want:
public abstract BaseClass{}
public Employee extends BaseClass {...}
Note that BaseClass is empty. I tried various approaches like using discriminator, all of etc. but it is not clear how to get this to work. Example:
BaseClass:
discriminator: classType
required:
- classType
properties:
entityType:
type: string
enum:
- Employee
Employee:
allOf:
- $ref: "BaseEntity"
properties:
#...properties defined here...
I understand that abstract is not supported by open api but perhaps there is some other mechanism like extension.
Wanted to see if anyone knows how to do this with open-api?
PS: Also tried something like this, did not work
BaseClass:
type: object
abstract: true
properties:
dummy:
type: string
description: "Dummy property to allow an empty base class"
readOnly: true
I tried x-abstract : true as well, didn't work. I'm open to other suggesttion like manually defining BaseClass and somehow having openAPI Employee specification extend that