From 5d1e6b3235f9cddf66611e7cf4f4d0b41ffd7368 Mon Sep 17 00:00:00 2001 From: Jan Friedli Date: Tue, 14 Jul 2020 15:28:08 +0200 Subject: upgrade to oas 3 --- matweb/oas/bulk.yml | 53 ++++++++++----------------- matweb/oas/components.yml | 68 +++++++++++++++++++++++++++++++++++ matweb/oas/download.yml | 49 ++++++++++++++----------- matweb/oas/extension.yml | 16 ++++----- matweb/oas/upload.yml | 92 +++++++++++++++-------------------------------- 5 files changed, 151 insertions(+), 127 deletions(-) create mode 100644 matweb/oas/components.yml (limited to 'matweb') diff --git a/matweb/oas/bulk.yml b/matweb/oas/bulk.yml index 08f346c..bbfe02e 100644 --- a/matweb/oas/bulk.yml +++ b/matweb/oas/bulk.yml @@ -6,47 +6,32 @@ description: "This endpoint allows you to bulk download several files which you uploaded beforehand. Note that the `download_list` MUST contain more than two files. The max length is configurable (default is 10)." -consumes: - - "application/json" -produces: - - "application/json" -parameters: -- in: "body" - name: "body" +requestBody: description: "The files that will be combined for one single download" required: true - schema: - $ref: '#/definitions/BulkBody' + content: + application/json: + schema: + $ref: '#/components/schemas/BulkBody' responses: 201: description: "A new resource to download all files as one archive" - schema: - $ref: '#/definitions/UploadResponse' + content: + application/json: + schema: + $ref: '#/components/schemas/UploadResponse' 400: description: "Invalid input" - schema: - $ref: '#/definitions/ErrorResponse' + content: + application/json: + schema: + oneOf: + - $ref: '#/components/schemas/ErrorAtLeastTwoResponse' + - $ref: '#/components/schemas/ErrorResponse' 500: description: "Unable to clean the file" - schema: - $ref: '#/definitions/ErrorResponse' - -definitions: - BulkBody: - type: "object" - properties: - download_list: - type: "array" - description: "An object containing the files you want to create a bulk download for" - items: - $ref: '#/definitions/BulkFile' - BulkFile: - type: "object" - properties: - file_name: - type: "string" - key: - type: "string" - secret: - type: "string" \ No newline at end of file + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' \ No newline at end of file diff --git a/matweb/oas/components.yml b/matweb/oas/components.yml new file mode 100644 index 0000000..82d07fb --- /dev/null +++ b/matweb/oas/components.yml @@ -0,0 +1,68 @@ +schemas: + BulkBody: + type: "object" + properties: + download_list: + type: "array" + description: "An object containing the files you want to create a bulk download for" + items: + $ref: '#/components/schemas/BulkFile' + BulkFile: + type: "object" + properties: + file_name: + type: "string" + key: + type: "string" + secret: + type: "string" + ErrorAtLeastTwoResponse: + type: "object" + properties: + message: + type: "object" + description: "A description of the error" + properties: + download_list: + type: "array" + items: + type: "string" + example: "Min length is 2" + UploadResponse: + type: "object" + properties: + inactive_after_sec: + type: "integer" + format: "int64" + description: "Defines after how many seconds the download wont be available" + output_filename: + type: "string" + description: "The resulting filename after metadata removal" + mime: + type: "string" + description: "The mime type of the cleaned file" + key: + type: "string" + description: "A key used to guarantee file integrity" + secret: + type: "string" + description: "A secret used to guarantee file integrity" + meta: + type: "object" + description: "An object of the removed metadata where key indicates the metadata type" + items: + type: "string" + meta_after: + type: "object" + description: "An object of the remaining metadata where key indicates the metadata type" + items: + type: "string" + download_link: + type: "string" + description: "The link to download the cleaned file" + ErrorResponse: + type: "object" + properties: + message: + type: "string" + description: "A description of the error" \ No newline at end of file diff --git a/matweb/oas/download.yml b/matweb/oas/download.yml index 899d103..e4a0ca4 100644 --- a/matweb/oas/download.yml +++ b/matweb/oas/download.yml @@ -2,30 +2,39 @@ tags: - "File Download" summary: 'Download a single cleaned file or zip archive containing multiple files' -consumes: - - "application/json" -produces: - - "*/*" parameters: -- name: "key" - in: "path" - description: "A key generated for that resource" - required: true - type: "string" -- name: "secret" - in: "path" - description: "A secret generated for that resource" - required: true - type: "string" -- name: "filename" - in: "path" - description: "the filename of the cleaned file" - required: true - type: "string" + - name: "key" + in: "path" + description: "A key generated for that resource" + required: true + schema: + type: "string" + - name: "secret" + in: "path" + description: "A secret generated for that resource" + required: true + schema: + type: "string" + - name: "filename" + in: "path" + description: "the filename of the cleaned file" + required: true + schema: + type: "string" responses: 200: - description: "" + description: "The cleaned file as attachment so a browser downloads the file directly" + content: + "*/*": + schema: + format: binary + 400: + description: "Invalid input" + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' 404: description: "The filename, key or secret are wrong or the link is too old and the file has been deleted" \ No newline at end of file diff --git a/matweb/oas/extension.yml b/matweb/oas/extension.yml index 3e31034..41314a7 100644 --- a/matweb/oas/extension.yml +++ b/matweb/oas/extension.yml @@ -2,16 +2,14 @@ tags: - "Supported Extensions" summary: 'Returns a list of all supported file extensions' -consumes: - - "application/json" -produces: - - "application/json" responses: 200: description: "A list of all supported file extensions" - schema: - type: "array" - items: - type: "string" - example: ".jpeg" \ No newline at end of file + content: + application/json: + schema: + type: "array" + items: + type: "string" + example: ".jpeg" \ No newline at end of file diff --git a/matweb/oas/upload.yml b/matweb/oas/upload.yml index 71cb87b..4133d08 100644 --- a/matweb/oas/upload.yml +++ b/matweb/oas/upload.yml @@ -2,79 +2,43 @@ tags: - "File Upload (Metadata removal)" summary: 'Upload a single file which will be cleaned from metadata' -consumes: - - "application/json" -produces: - - "application/json" -parameters: -- in: "body" - name: "body" +requestBody: description: "The file that will be cleaned from metadata. Note that the file must be base64 encoded" required: true - schema: - type: "object" - properties: - file_name: - type: "string" - example: 'my_example.jpg' - file: - type: "string" - example: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==' + content: + application/json: + schema: + type: "object" + properties: + file_name: + type: "string" + example: 'my_example.jpg' + file: + type: "string" + example: 'iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==' responses: 201: description: "An object containing all info about the cleaned file" - schema: - $ref: '#/definitions/UploadResponse' + content: + application/json: + schema: + $ref: '#/components/schemas/UploadResponse' 400: description: "Invalid input" - schema: - $ref: '#/definitions/ErrorResponse' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' 415: description: "Unsupported file type" - schema: - $ref: '#/definitions/ErrorResponse' + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' 500: description: "Unable to clean the file" - schema: - $ref: '#/definitions/ErrorResponse' - -definitions: - UploadResponse: - type: "object" - properties: - inactive_after_sec: - type: "integer" - format: "int64" - description: "Defines after how many seconds the download wont be available" - output_filename: - type: "string" - description: "The resulting filename after metadata removal" - mime: - type: "string" - description: "The mime type of the cleaned file" - key: - type: "string" - description: "A key used to guarantee file integrity" - secret: - type: "string" - description: "A secret used to guarantee file integrity" - meta: - type: "object" - description: "An object of the removed metadata where key indicates the metadata type" - items: - type: "string" - meta_after: - type: "object" - description: "An object of the remaining metadata where key indicates the metadata type" - items: - type: "string" - download_link: - type: "string" - description: "The link to download the cleaned file" - ErrorResponse: - type: "object" - properties: - message: - type: "string" - description: "A description of the error" \ No newline at end of file + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorResponse' \ No newline at end of file -- cgit v1.3