Polymorphic properties discrimated by path
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-02-2023
08:11 AM
02-02-2023
08:11 AM
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?
Labels:
- Labels:
-
Swagger Core
0 REPLIES 0
