Skip to content

Commit

Permalink
Swagger: Revert BinaryResponse type to string
Browse files Browse the repository at this point in the history
Go-swagger does not appear to support `"format": "binary"`, and `"$ref": "#/definitions/File"` doesn't seem to be supported. Resolves #118
  • Loading branch information
axllent committed Nov 19, 2023
1 parent 1c8b96d commit 695c607
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 2 additions & 7 deletions server/apiv1/swagger.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package apiv1

import "os"

// These structs are for the purpose of defining swagger HTTP responses

// Application information
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down
9 changes: 2 additions & 7 deletions server/ui/api/v1/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
}
Expand Down

0 comments on commit 695c607

Please sign in to comment.