-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Hey,
Is it possible to describe a response with multiple content-types using tspec?
Example from: https://swagger.io/docs/specification/describing-responses/
paths:
/users:
get:
summary: Get all users
responses:
'200':
description: A list of users
content:
application/json:
schema:
$ref: '#/components/schemas/ArrayOfUsers'
application/xml:
schema:
$ref: '#/components/schemas/ArrayOfUsers'
text/plain:
schema:
type: stringIt seems that I would add the mediatype as js-doc to the reponse like in this example: https://ts-spec.github.io/tspec/guide/file-upload-download#file-download
export type UserApiSpec = Tspec.DefineApiSpec<{
tags: ["Users"];
paths: {
"/api/users": {
get: {
summary: "Get all users";
responses: {
/** @mediaType application/json */
/** @mediaType text/xml */
200: Users[];
};
};
};
};
}>;But that just takes the last value:
"/api/users": {
"get": {
"operationId": "UserApiSpec_get_/api/users",
"tags": [
"Users"
],
"summary": "Get all users",
"parameters": [],
"responses": {
"200": {
"description": "",
"content": {
"text/xml": {
"schema": {
"mediaType": "text/xml",
"type": "array",
"items": {
"$ref": "#/components/schemas/Users"
}
}
}
}
}
}
}
}hyeonss0417
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request