Skip to content

Instantly share code, notes, and snippets.

@tiholic
Last active July 16, 2021 12:30
Show Gist options
  • Save tiholic/99cf45e7eebe24ff4fc3bc02802f4485 to your computer and use it in GitHub Desktop.
Save tiholic/99cf45e7eebe24ff4fc3bc02802f4485 to your computer and use it in GitHub Desktop.
openapi schema with multipart and json inputs with different payloads for same endpoint
{
"openapi": "3.0.0",
"info": {
"title": "API",
"description": "API",
"version": "1.0"
},
"components": {
"schemas": {
"FileInput": {
"type": "object",
"properties": {
"file": {
"type": "string",
"format": "binary"
}
},
"required": [
"file"
]
},
"FileInputAsJson": {
"type": "object",
"properties": {
"key": {
"type": "string"
}
},
"required": [
"key"
]
}
}
},
"paths": {
"/api/v2/action/": {
"post": {
"responses": {
"201": {
"description": ""
}
},
"tags": [
"v2api"
],
"security": [
{
"jwt": []
}
],
"operationId": "upload2",
"summary": "Upload file temporarily",
"requestBody": {
"content": {
"multipart/form-data": {
"schema": {
"$ref": "#/components/schemas/FileInput"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/FileInputAsJson"
}
}
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment