Skip to content

Instantly share code, notes, and snippets.

@ehvattum
Created January 18, 2023 09:43
Show Gist options
  • Save ehvattum/e7fdc53bda8a3d03556c0c649cdef7c9 to your computer and use it in GitHub Desktop.
Save ehvattum/e7fdc53bda8a3d03556c0c649cdef7c9 to your computer and use it in GitHub Desktop.
Openapi multiple content-types responses
{
"openapi":"3.0.2",
"info": {
"title":"Multi content-type generator spec",
"version":"1.0"
},
"servers": [
{"url":"https://api.server.test/v1"}
],
"paths": {
"/pdf-or-json": {
"get": {
"summary": "Return a .pdf, or a json error",
"operationId": "getPdfOrJson",
"parameters": [],
"responses": {
"200": {
"description": "OK",
"content": {
"application/pdf": {
"schema": {
"type": "string",
"format": "binary"
}
}
},
"headers": {}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error-message": {
"type": "string"
}
}
}
}
}
}
}
}
},
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment