Forum Discussion
HKosova
Alumni
6 years agoYou can define a base schema with common properties and use allOf+$ref to "inherit" from that base schema.
In your example, you can inherit the sessionOpenResponse schema from sessionCloseRequest as follows:
"sessionOpenResponse": {
"allOf": [
{
"$ref": "#/definitions/sessionCloseRequest"
},
{
"type": "object",
"properties": {
"oauthToken": {
"description": "This token is valid for 60 mins. and should be passed as 'Authorization: Bearer oauthToken' header when invoking the APIs",
"example": "0efb61f4-3b06-3502-8987-c6e2e187244c",
"type": "string"
}
}
}
]
}
HareeshKota
6 years agoNew Contributor
Thank You Helen Kosova for the response.
That's helpful, but how to handle this when I have few more properties in "sessionCloseRequest" and i don't want all of them to be referred in to the "sessionOpenResponse" ? How to refere a few particular properties ?
Regards,
Hareesh
- HKosova6 years ago
Alumni
Define a base schema with common properties and inherit both sessionCloseRequest and sessionOpenResponse from that base schema.