I want to have a combined response of another response and an array of objects for my endpoint like the below example:
{
access: "string",
refresh: "string",
"hospitals": [
{
"title": "a hospital",
"base_url": "hospital.com",
"secret_key": "68e656b251e67e8358bef8483ab0d51c6619f3e7a1a9f0e75838d41ff368f728"
}
]
}
Below is my token pair response which consists of access
and refresh
:
responses:
TokenPairResponse:
description: generated token pair
content:
application/json:
schema:
type: object
properties:
access:
type: string
refresh:
type: string
Also, to create an array of hospitals:
description: user verified successfully
content:
application/json:
schema:
type: object
properties:
hospitals:
type: array
items:
$ref: "#/components/schemas/Hospital"
Now, I want to know if there is any way to have a combination of array of hospitals
and TokenPairResponse
in a single response like the abovementioned example.
Update: I've added these to responses:
hospitals:
description: array of hostpitals
content:
application/json:
schema:
type: object
properties:
hospitals:
type: array
items:
$ref: "#/components/schemas/Hospital"
VerifyUser:
description: repsonse of user successfull verfication
content:
application/json:
schema:
allOf:
- $ref: "#/components/responses/hospitals"
- $ref: "#/components/responses/TokenPairResponse"
And I've referenced them in my path like this:
responses:
200:
description: user verified successfully
$ref: "#/components/responses/VerifyUser"
This will not render, and I get: no example available