Closed
Description
I'd like to define an API to allow the client to accept either application/json
or application/problem+json
for responses; they share the same schema and description. At present, I must copy/paste the Media Type Object each time, rather than define it oncereuse one
That is, I must code:
'400':
description: Bad Request
content:
application/json:
description: {My description of the response}
schema:
$ref: '#/components/schemas/problemResponse'
application/problem+json:
description: {My description of the response}
schema:
$ref: '#/components/schemas/problemResponse'
when I'd really like to do is
'400':
description: Bad Request
content:
application/json:
description: {My description of the response}
schema:
$ref: '#/components/schemas/problemResponse'
application/problem+json:
$ref: '#../application~1json'
Maintaining copies is not scalable, especially if one uses Specification Extensions inside the media type object
Each operation's 400 response (or each 422 response, etc) may differ (error descriptions change) so using a $ref
for the entire Response Object is not a complete solution.