Consider this simple example with inheritance : a Pet is either a Dog or a Cat (petType is used for discrimination). Dogs and Cats have specific attributes :
Dogs have dogAttribute1
Cats have catAttribute1
This example can be represented by the following yaml (OpenAPI spec version 3). Endpoint /pets allows to create a Pet (either a Dog or a Cat).
I don't know if this is easily feasible : I've seen that discriminator is not supported yet, so there is probably a reason. I would have liked to help, but my knowledge of JavaScript is close to zero :smile:
Hello,
Consider this simple example with inheritance : a
Pet
is either aDog
or aCat
(petType
is used for discrimination).Dog
s andCat
s have specific attributes :Dog
s havedogAttribute1
Cat
s havecatAttribute1
This example can be represented by the following yaml (OpenAPI spec version 3). Endpoint
/pets
allows to create aPet
(either aDog
or aCat
).This is the result of
openapi2schema -i /path/to/myfile.yaml
(I used CLI wrapper here, but I'm sure the issue comes from the library) :As you see, inheritance is not correctly handled (nothing about
Dog
orCat
here). I would have expected something like this instead :I don't know if this is easily feasible : I've seen that
discriminator
is not supported yet, so there is probably a reason. I would have liked to help, but my knowledge of JavaScript is close to zero :smile:Anyway, thanks for this library.