Hi,
I guess my previous question was a bit too long ;) Could I possibly just
ask you to help me with the following two simple questions instead?
1. Is the following model with the a resource operation returning a Pet,
which can be 'oneOf' Dog/Cat correct? I'm precisely asking if this is fine
to wrap the 'oneOf' in an additional 'parent' type):
{
"openapi": "3.0.1",
"info": {
"title": "notitle",
"version": "1.0.0"
},
"paths": {
"/pets/": {
"get": {
"parameters": [],
"responses": {
"default": {
"description": "default response",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Pet"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Cat": {
"type": "object",
"properties": {
"noise": {
"type": "string"
},
"catProperty": {
"type": "string"
}
}
},
"Dog": {
"type": "object",
"properties": {
"noise": {
"type": "string"
},
"dogProperty": {
"type": "string"
}
}
},
"Pet": {
"type": "object",
"oneOf": [
{
"$ref": "#/components/schemas/Dog"
},
{
"$ref": "#/components/schemas/Cat"
}
]
}
}
}
}
2. What is the preferred way of modelling a resource operation returning a
polymorphic type with some common attributes (Pet [age], Dog [dogProperty]
extends Pet, Cat [catProperty] extends Pet)?
Thanks!
MichaĆ
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.