rmschroeder
2 years agoOccasional Visitor
Polymorphic properties discrimated by path
I would like to specify that the value of the input parameter in the Path is used as a discrimator in the requestBody and responses of a call.
For example, If I could POST to a path /echo/{inputTypeName} where inputTypeName is oneOf [ Cat, Dog ].
If it is Cat, then the requestBody MUST be $ref:'#/components/schema/Cat' and the response should be the same.
If it is Dog, then the requestBody MUST be $ref:'#/components/schema/Dog' and the response should be the same.
Assume that Cat a Dog do not have any shared properties.
Is there a way to create an OpenApi 3.x spec that allows for this?