From 7520f02d818b3069d44bfb03d7ce345b808eaa5f Mon Sep 17 00:00:00 2001 From: YassinHajaj Date: Mon, 6 Feb 2023 16:11:15 +0100 Subject: [PATCH 1/4] Update openapi3 file to add the content Adding the request body's content with application/offset+octet-stream --- OpenAPI/openapi3.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenAPI/openapi3.yaml b/OpenAPI/openapi3.yaml index 825da9f..2648643 100755 --- a/OpenAPI/openapi3.yaml +++ b/OpenAPI/openapi3.yaml @@ -81,6 +81,11 @@ paths: requestBody: description: (Possibly partial) content of the file. Required if Content-Length > 0. required: false + content: + application/offset+octet-stream": + schema: + type: string + format: binary responses: 201: description: Created @@ -334,6 +339,11 @@ paths: requestBody: description: Remaining (possibly partial) content of the file. Required if Content-Length > 0. required: false + content: + application/offset+octet-stream": + schema: + type: string + format: binary responses: 204: description: Upload offset was updated From 8347b5458462e5e09ce518d720ac5fe1f11cef30 Mon Sep 17 00:00:00 2001 From: YassinHajaj Date: Mon, 6 Feb 2023 17:49:35 +0100 Subject: [PATCH 2/4] Fixed incorrect content-type (quotes at the end) --- OpenAPI/openapi3.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenAPI/openapi3.yaml b/OpenAPI/openapi3.yaml index 2648643..253c140 100755 --- a/OpenAPI/openapi3.yaml +++ b/OpenAPI/openapi3.yaml @@ -82,7 +82,7 @@ paths: description: (Possibly partial) content of the file. Required if Content-Length > 0. required: false content: - application/offset+octet-stream": + application/offset+octet-stream: schema: type: string format: binary @@ -340,7 +340,7 @@ paths: description: Remaining (possibly partial) content of the file. Required if Content-Length > 0. required: false content: - application/offset+octet-stream": + application/offset+octet-stream: schema: type: string format: binary From 26b2c5679f0c9ec3aa69bd08ee18b83288c64ff2 Mon Sep 17 00:00:00 2001 From: YassinHajaj Date: Mon, 13 Feb 2023 20:05:49 +0100 Subject: [PATCH 3/4] PATCH can also be POST PATCH can be replaced by POST with X-HTTP-Method-Override PATCH --- OpenAPI/openapi3.yaml | 121 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) diff --git a/OpenAPI/openapi3.yaml b/OpenAPI/openapi3.yaml index 253c140..39f5077 100755 --- a/OpenAPI/openapi3.yaml +++ b/OpenAPI/openapi3.yaml @@ -426,6 +426,127 @@ paths: Tus-Resumable: schema: $ref: "#/components/schemas/Tus-Resumable" + post: + summary: Used to resume the upload + description: 'This method is practically the same as the patch. Except that it uses the + X-HTTP-Method-Override header to simulate a PATCH' + operationId: FilePatchViaPost + parameters: + - name: id + in: path + required: true + schema: + type: string + - name: Tus-Resumable + in: header + required: true + schema: + $ref: "#/components/schemas/Tus-Resumable" + - name: Content-Length + in: header + description: Length of the body of this request + required: true + schema: + type: integer + - name: Upload-Offset + in: header + required: true + schema: + $ref: "#/components/schemas/Upload-Offset" + - name: Upload-Checksum + in: header + schema: + $ref: "#/components/schemas/Upload-Checksum" + requestBody: + description: Remaining (possibly partial) content of the file. Required if Content-Length > 0. + required: false + content: + application/offset+octet-stream: + schema: + type: string + format: binary + responses: + 204: + description: Upload offset was updated + headers: + Tus-Resumable: + schema: + $ref: "#/components/schemas/Tus-Resumable" + Upload-Offset: + schema: + $ref: "#/components/schemas/Tus-Resumable" + Upload-Expires: + description: Added by the expiration extension. The Upload-Expires response + header indicates the time after which the unfinished upload expires. + A Server MAY wish to remove incomplete uploads after a given period + of time to prevent abandoned uploads from taking up extra storage. + The Client SHOULD use this header to determine if an upload is still + valid before attempting to resume the upload. This header MUST be + included in every PATCH (via POST) response if the upload is going to expire. + If the expiration is known at the creation, the Upload-Expires header + MUST be included in the response to the initial POST request. Its + value MAY change over time. If a Client does attempt to resume an + upload which has since been removed by the Server, the Server SHOULD + respond with the 404 Not Found or 410 Gone status. The latter one + SHOULD be used if the Server is keeping track of expired uploads. + In both cases the Client SHOULD start a new upload. The value of the + Upload-Expires header MUST be in RFC 7231 datetime format. + schema: + type: string + 400: + description: Added by the checksum extension. The checksum algorithm is + not supported by the server + headers: + Tus-Resumable: + schema: + $ref: "#/components/schemas/Tus-Resumable" + 403: + description: In the concatenation extension, the Server MUST respond with + the 403 Forbidden status to PATCH (via POST) requests against a final upload URL + and MUST NOT modify the final or its partial uploads. + headers: + Tus-Resumable: + schema: + $ref: "#/components/schemas/Tus-Resumable" + 404: + description: PATCH (via POST) request against a non-existent resource + headers: + Tus-Resumable: + schema: + $ref: "#/components/schemas/Tus-Resumable" + 409: + description: PATCH (via POST) request with Upload-Offset unequal to the offset of the resource on the server. The Upload-Offset header's value MUST be equal to the current offset of the resource. + headers: + Tus-Resumable: + schema: + $ref: "#/components/schemas/Tus-Resumable" + 410: + description: PATCH (via POST) request against a non-existent resource + headers: + Tus-Resumable: + schema: + $ref: "#/components/schemas/Tus-Resumable" + 412: + description: Precondition Failed + headers: + Tus-Resumable: + schema: + $ref: "#/components/schemas/Tus-Resumable" + Tus-Version: + schema: + $ref: "#/components/schemas/Tus-Version" + 415: + description: Content-Type was not application/offset+octet-stream + headers: + Tus-Resumable: + schema: + $ref: "#/components/schemas/Tus-Resumable" + 460: + description: Added by the checksum extension. Checksums mismatch + headers: + Tus-Resumable: + schema: + $ref: "#/components/schemas/Tus-Resumable" components: schemas: Tus-Resumable: From 32d15c5199cbe3f689e05c98541c4254ce34e8ca Mon Sep 17 00:00:00 2001 From: YassinHajaj Date: Mon, 13 Feb 2023 20:23:12 +0100 Subject: [PATCH 4/4] Added mandatory header X-HTTP-Method-Override --- OpenAPI/openapi3.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/OpenAPI/openapi3.yaml b/OpenAPI/openapi3.yaml index 39f5077..aa9c8e3 100755 --- a/OpenAPI/openapi3.yaml +++ b/OpenAPI/openapi3.yaml @@ -457,6 +457,12 @@ paths: in: header schema: $ref: "#/components/schemas/Upload-Checksum" + - name: X-HTTP-Method-Override + in: header + schema: + type: string + enum: [PATCH] + required: true requestBody: description: Remaining (possibly partial) content of the file. Required if Content-Length > 0. required: false