From 695c6078ac80a5c4334f18c4887ca165e3989441 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Sun, 19 Nov 2023 14:56:27 +1300 Subject: [PATCH] Swagger: Revert BinaryResponse type to string Go-swagger does not appear to support `"format": "binary"`, and `"$ref": "#/definitions/File"` doesn't seem to be supported. Resolves #118 --- server/apiv1/swagger.go | 9 ++------- server/ui/api/v1/swagger.json | 9 ++------- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/server/apiv1/swagger.go b/server/apiv1/swagger.go index b5ed980d6..dc15baf5e 100644 --- a/server/apiv1/swagger.go +++ b/server/apiv1/swagger.go @@ -1,7 +1,5 @@ package apiv1 -import "os" - // These structs are for the purpose of defining swagger HTTP responses // Application information @@ -148,10 +146,7 @@ type linkCheckParams struct { // Binary data response inherits the attachment's content type // swagger:response BinaryResponse -type binaryResponse struct { - // in: body - File os.File -} +type binaryResponse string // Plain text response // swagger:response TextResponse @@ -161,7 +156,7 @@ type textResponse string // swagger:response HTMLResponse type htmlResponse string -// Error response +// HTTP error response will return with a >= 400 response code // swagger:response ErrorResponse type errorResponse string diff --git a/server/ui/api/v1/swagger.json b/server/ui/api/v1/swagger.json index 29c18da5d..5f4526d73 100644 --- a/server/ui/api/v1/swagger.json +++ b/server/ui/api/v1/swagger.json @@ -809,11 +809,6 @@ "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", @@ -1387,11 +1382,11 @@ "BinaryResponse": { "description": "Binary data response inherits the attachment's content type", "schema": { - "$ref": "#/definitions/File" + "type": "string" } }, "ErrorResponse": { - "description": "Error response", + "description": "HTTP error response will return with a \u003e= 400 response code", "schema": { "type": "string" }