Change swagger.json to OpenAPI 3.0

This commit is contained in:
Kumi 2020-09-03 12:16:10 +02:00
parent e925f79b8f
commit 0658a92326

View file

@ -1,124 +1,188 @@
swagger: "2.0" {
info: "openapi": "3.0.0",
description: "A simple endpoint to send email messages" "info": {
version: "0.1" "description": "A simple endpoint to send email messages",
title: "EXPMail" "version": "0.1",
contact: "title": "EXPMail",
email: "support@kumi.systems" "contact": {
host: "expmail.kumi.live" "email": "support@kumi.systems"
tags: }
- name: "sending" },
description: "Sending out an email" "tags": [
schemes: {
- "https" "name": "sending",
paths: "description": "Sending out an email"
/sender.php: }
post: ],
tags: "paths": {
- "sending" "/sender.php": {
summary: "Send out an email" "post": {
operationId: "sendMail" "tags": [
consumes: "sending"
- "application/json" ],
produces: "summary": "Send out an email",
- "application/json" "operationId": "sendMail",
parameters: "requestBody": {
- in: "body" "content": {
name: "data" "application/json": {
description: "Object defining the email message to be sent" "schema": {
required: true "$ref": "#/components/schemas/Mail"
schema: }
$ref: "#/definitions/Mail" }
responses: },
200: "description": "Object defining the email message to be sent",
description: "The request was received and processed." "required": true
schema: },
type: "object" "responses": {
properties: "200": {
status: "description": "The request was received and processed.",
type: "string" "content": {
description: "\"Success\" if message was successfully sent, else \"error\"" "application/json": {
error: "schema": {
type: "string" "type": "object",
description: "Error message, only included if an error has occurred" "properties": {
definitions: "status": {
Placeholder: "type": "string",
type: "object" "description": "\"Success\" if message was successfully sent, else \"error\""
required: ["name"] },
properties: "error": {
name: "type": "string",
type: "string" "description": "Error message, only included if an error has occurred"
description: "Name of the placeholder - will be converted to ALL CAPS by the server if it isn't already" }
value: }
type: "string" }
description: "Value to insert into placeholder" }
Attachment: }
type: "object" }
required: ["url"] }
properties: }
url: }
type: "string" },
format: "url" "servers": [
description: "URL from where to fetch the file to attach" {
filename: "url": "https://expmail.kumi.live"
type: "string" }
description: "File name to use for email attachment. If not set, defaults to name from Content-Disposition header of URL if it exists, else the base name of the URL." ],
Recipient: "components": {
type: "object" "schemas": {
required: ["email"] "Placeholder": {
properties: "type": "object",
email: "required": [
type: "string" "name"
format: "email" ],
description: "Email address of the recipient" "properties": {
name: "name": {
type: "string" "type": "string",
description: "Name of the recipient" "description": "Name of the placeholder - will be converted to ALL CAPS by the server if it isn't already"
Mail: },
type: "object" "value": {
required: ["recipients", "key"] "type": "string",
properties: "description": "Value to insert into placeholder"
subject: }
type: "string" }
description: "Subject of the email" },
html: "Attachment": {
type: "string" "type": "object",
description: "String containing the HTML content of the email. Takes precedence over `htmlurl` if provided. If both `html` and `text` or `texturl` are provided, will create a multi-part MIME message." "required": [
htmlurl: "url"
type: "string" ],
description: "String containing the URL to a file containing the HTML content of the email. Ignored (but still validated) if `html` if provided. If both `htmlurl` and `text` or `texturl` are provided, will create a multi-part MIME message." "properties": {
text: "url": {
type: "string" "type": "string",
description: "String containing the plain text content of the email. Takes precedence over `texturl` if provided. If both `text` and `html` or `htmlurl` are provided, will create a multi-part MIME message." "format": "url",
texturl: "description": "URL from where to fetch the file to attach"
type: "string" },
description: "String containing the URL to a file containing the plain text content of the email. Ignored (but still validated) if `text` is provided. If both `texturl` and `html` or `htmlurl` are provided, will create a multi-part MIME message." "filename": {
recipients: "type": "string",
type: "array" "description": "File name to use for email attachment. If not set, defaults to name from Content-Disposition header of URL if it exists, else the base name of the URL."
description: "Array of `Recipient` objects to be used as \"To:\" addresses for the email" }
items: }
$ref: "#/definitions/Recipient" },
ccs: "Recipient": {
type: "array" "type": "object",
description: "Array of `Recipient` objects to be used as \"CC:\" addresses for the email" "required": [
items: "email"
$ref: "#/definitions/Recipient" ],
bccs: "properties": {
type: "array" "email": {
description: "Array of `Recipient` objects to be used as \"BCC:\" addresses for the email" "type": "string",
items: "format": "email",
$ref: "#/definitions/Recipient" "description": "Email address of the recipient"
attachments: },
type: "array" "name": {
description: "Array of `Attachment` objects to be attached to the email" "type": "string",
items: "description": "Name of the recipient"
$ref: "#/definitions/Attachment" }
placeholders: }
type: "array" },
description: "Array of `Placeholder` objects. Any occurrences of `{PLACEHOLDER_NAME}` (`name` in all caps enclosed with curly brackets) in the email's HTML or plain text will be replaced by `value`." "Mail": {
items: "type": "object",
$ref: "#/definitions/Placeholder" "required": [
key: "recipients",
type: "string" "key"
description: "API key to authenticate request with" ],
"properties": {
"subject": {
"type": "string",
"description": "Subject of the email"
},
"html": {
"type": "string",
"description": "String containing the HTML content of the email. Takes precedence over `htmlurl` if provided. If both `html` and `text` or `texturl` are provided, will create a multi-part MIME message."
},
"htmlurl": {
"type": "string",
"description": "String containing the URL to a file containing the HTML content of the email. Ignored (but still validated) if `html` if provided. If both `htmlurl` and `text` or `texturl` are provided, will create a multi-part MIME message."
},
"text": {
"type": "string",
"description": "String containing the plain text content of the email. Takes precedence over `texturl` if provided. If both `text` and `html` or `htmlurl` are provided, will create a multi-part MIME message."
},
"texturl": {
"type": "string",
"description": "String containing the URL to a file containing the plain text content of the email. Ignored (but still validated) if `text` is provided. If both `texturl` and `html` or `htmlurl` are provided, will create a multi-part MIME message."
},
"recipients": {
"type": "array",
"description": "Array of `Recipient` objects to be used as \"To:\" addresses for the email",
"items": {
"$ref": "#/components/schemas/Recipient"
}
},
"ccs": {
"type": "array",
"description": "Array of `Recipient` objects to be used as \"CC:\" addresses for the email",
"items": {
"$ref": "#/components/schemas/Recipient"
}
},
"bccs": {
"type": "array",
"description": "Array of `Recipient` objects to be used as \"BCC:\" addresses for the email",
"items": {
"$ref": "#/components/schemas/Recipient"
}
},
"attachments": {
"type": "array",
"description": "Array of `Attachment` objects to be attached to the email",
"items": {
"$ref": "#/components/schemas/Attachment"
}
},
"placeholders": {
"type": "array",
"description": "Array of `Placeholder` objects. Any occurrences of `{PLACEHOLDER_NAME}` (`name` in all caps enclosed with curly brackets) in the email's HTML or plain text will be replaced by `value`.",
"items": {
"$ref": "#/components/schemas/Placeholder"
}
},
"key": {
"type": "string",
"description": "API key to authenticate request with"
}
}
}
}
}
}