this description
"Person" : {
"type" : "object",
"discriminator": ...,
"properties" : { ... }
},
"Company" : {
"allOf" : [
{
"$ref" : "#/definitions/Person"
},
{
"type" : "object",
"properties" : { ... }
}
]
}
generates a working Person case class, but Company is generated as
case object Company
even if Company does have its own properties.
the Model in this case turns out to be a ComposedModel which, although it does not have properties itself, it does have a getAllOf
method, so just accumulating properties is easy.
more difficult here is handling the discriminator: Person should really be a sealed trait (?) and Company an implementation of that trait. sadly, how exactly the discriminator property can be used to find out which subtype of Person to deserialize is not properly defined yet, see OAI/OpenAPI-Specification#403 .
for now i propose to generate Person as before and have subtypes like Company include the discriminator field, so the user is responsible to set the correct value ther manually.