From 4c3e073b0c1a825cd687fe575f7cb07157909bef Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Mon, 16 Oct 2023 17:34:10 +1300 Subject: [PATCH] Change swagger BinaryResponse to os.File --- server/apiv1/swagger.go | 7 ++++++- server/ui/api/v1/swagger.json | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/server/apiv1/swagger.go b/server/apiv1/swagger.go index 583714fed..b5ed980d6 100644 --- a/server/apiv1/swagger.go +++ b/server/apiv1/swagger.go @@ -1,5 +1,7 @@ package apiv1 +import "os" + // These structs are for the purpose of defining swagger HTTP responses // Application information @@ -146,7 +148,10 @@ type linkCheckParams struct { // Binary data response inherits the attachment's content type // swagger:response BinaryResponse -type binaryResponse string +type binaryResponse struct { + // in: body + File os.File +} // Plain text response // swagger:response TextResponse diff --git a/server/ui/api/v1/swagger.json b/server/ui/api/v1/swagger.json index c85fff451..29c18da5d 100644 --- a/server/ui/api/v1/swagger.json +++ b/server/ui/api/v1/swagger.json @@ -809,6 +809,11 @@ "x-go-name": "deleteMessagesRequestBody", "x-go-package": "github.com/axllent/mailpit/server/apiv1" }, + "File": { + "type": "object", + "title": "File represents an open file descriptor.", + "x-go-package": "os" + }, "HTMLCheckResponse": { "description": "Response represents the HTML check response struct", "type": "object", @@ -1382,7 +1387,7 @@ "BinaryResponse": { "description": "Binary data response inherits the attachment's content type", "schema": { - "type": "string" + "$ref": "#/definitions/File" } }, "ErrorResponse": {