From 7c366669c72762f3e38ee8d95011c4ff59c06dd3 Mon Sep 17 00:00:00 2001 From: Ralph Slooten Date: Fri, 14 Feb 2025 16:10:54 +1300 Subject: [PATCH] Fix: Update Swagger JSON to prevent overflow (#442) --- internal/smtpd/chaos/chaos.go | 2 ++ server/apiv1/chaos.go | 4 +--- server/ui/api/v1/swagger.json | 10 +++++++--- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/internal/smtpd/chaos/chaos.go b/internal/smtpd/chaos/chaos.go index 72d9558..d9994e0 100644 --- a/internal/smtpd/chaos/chaos.go +++ b/internal/smtpd/chaos/chaos.go @@ -25,6 +25,7 @@ var ( ) // Triggers for the Chaos configuration +// swagger:model Triggers type Triggers struct { // Sender trigger to fail on From, Sender Sender Trigger @@ -35,6 +36,7 @@ type Triggers struct { } // Trigger for Chaos +// swagger:model Trigger type Trigger struct { // SMTP error code to return. The value must range from 400 to 599. // required: true diff --git a/server/apiv1/chaos.go b/server/apiv1/chaos.go index c2ff3b4..b538e8b 100644 --- a/server/apiv1/chaos.go +++ b/server/apiv1/chaos.go @@ -7,9 +7,7 @@ import ( "github.com/axllent/mailpit/internal/smtpd/chaos" ) -// ChaosTriggers is the Chaos configuration -// -// swagger:model Triggers +// ChaosTriggers are the Chaos triggers type ChaosTriggers chaos.Triggers // Response for the Chaos triggers configuration diff --git a/server/ui/api/v1/swagger.json b/server/ui/api/v1/swagger.json index efcf2b1..7058bde 100644 --- a/server/ui/api/v1/swagger.json +++ b/server/ui/api/v1/swagger.json @@ -69,7 +69,7 @@ "name": "Body", "in": "body", "schema": { - "$ref": "#/definitions/Triggers" + "$ref": "#/definitions/ChaosTriggers" } } ], @@ -1188,6 +1188,10 @@ }, "x-go-package": "github.com/axllent/mailpit/internal/storage" }, + "ChaosTriggers": { + "description": "ChaosTriggers are the Chaos triggers", + "$ref": "#/definitions/Triggers" + }, "HTMLCheckResponse": { "description": "Response represents the HTML check response struct", "type": "object", @@ -1920,7 +1924,7 @@ "$ref": "#/definitions/Trigger" } }, - "$ref": "#/definitions/Triggers" + "x-go-package": "github.com/axllent/mailpit/internal/smtpd/chaos" }, "WebUIConfiguration": { "description": "Response includes global web UI settings", @@ -2002,7 +2006,7 @@ "ChaosResponse": { "description": "Response for the Chaos triggers configuration", "schema": { - "$ref": "#/definitions/Triggers" + "$ref": "#/definitions/ChaosTriggers" } }, "ErrorResponse": {