Fix: Refactor Web UI configuration definitions in Swagger documentation

This commit is contained in:
Ralph Slooten
2026-06-19 21:51:55 +12:00
parent 7da82df24d
commit 9dbb092447
2 changed files with 103 additions and 94 deletions

View File

@@ -53,49 +53,53 @@ type jsonErrorResponse struct {
}
}
// Web UI configuration settings
// swagger:model WebUIConfiguration
type WebUIConfiguration struct {
// Optional label to identify this Mailpit instance
Label string
// Message Relay information
MessageRelay struct {
// Whether message relaying (release) is enabled
Enabled bool
// The configured SMTP server address
SMTPServer string
// Enforced Return-Path (if set) for relay bounces
ReturnPath string
// Only allow relaying to these recipients (regex)
AllowedRecipients string
// Block relaying to these recipients (regex)
BlockedRecipients string
// Overrides the "From" address for all relayed messages
OverrideFrom string
// Preserve the original Message-IDs when relaying messages
PreserveMessageIDs bool
// DEPRECATED 2024/03/12
// swagger:ignore
RecipientAllowlist string
}
// Whether SpamAssassin is enabled
SpamAssassin bool
// Whether Chaos support is enabled at runtime
ChaosEnabled bool
// Whether messages with duplicate IDs are ignored
DuplicatesIgnored bool
// Whether the delete button should be hidden
HideDeleteAllButton bool
}
// Web UI configuration response
// swagger:response WebUIConfigurationResponse
type webUIConfigurationResponse struct {
// Web UI configuration settings
//
// in: body
Body struct {
// Optional label to identify this Mailpit instance
Label string
// Message Relay information
MessageRelay struct {
// Whether message relaying (release) is enabled
Enabled bool
// The configured SMTP server address
SMTPServer string
// Enforced Return-Path (if set) for relay bounces
ReturnPath string
// Only allow relaying to these recipients (regex)
AllowedRecipients string
// Block relaying to these recipients (regex)
BlockedRecipients string
// Overrides the "From" address for all relayed messages
OverrideFrom string
// Preserve the original Message-IDs when relaying messages
PreserveMessageIDs bool
// DEPRECATED 2024/03/12
// swagger:ignore
RecipientAllowlist string
}
// Whether SpamAssassin is enabled
SpamAssassin bool
// Whether Chaos support is enabled at runtime
ChaosEnabled bool
// Whether messages with duplicate IDs are ignored
DuplicatesIgnored bool
// Whether the delete button should be hidden
HideDeleteAllButton bool
}
Body WebUIConfiguration
}
// Application information

View File

@@ -1955,6 +1955,67 @@
},
"x-go-name": "Result",
"x-go-package": "github.com/axllent/mailpit/internal/spamassassin"
},
"WebUIConfiguration": {
"description": "Web UI configuration settings",
"type": "object",
"properties": {
"ChaosEnabled": {
"description": "Whether Chaos support is enabled at runtime",
"type": "boolean"
},
"DuplicatesIgnored": {
"description": "Whether messages with duplicate IDs are ignored",
"type": "boolean"
},
"HideDeleteAllButton": {
"description": "Whether the delete button should be hidden",
"type": "boolean"
},
"Label": {
"description": "Optional label to identify this Mailpit instance",
"type": "string"
},
"MessageRelay": {
"description": "Message Relay information",
"type": "object",
"properties": {
"AllowedRecipients": {
"description": "Only allow relaying to these recipients (regex)",
"type": "string"
},
"BlockedRecipients": {
"description": "Block relaying to these recipients (regex)",
"type": "string"
},
"Enabled": {
"description": "Whether message relaying (release) is enabled",
"type": "boolean"
},
"OverrideFrom": {
"description": "Overrides the \"From\" address for all relayed messages",
"type": "string"
},
"PreserveMessageIDs": {
"description": "Preserve the original Message-IDs when relaying messages",
"type": "boolean"
},
"ReturnPath": {
"description": "Enforced Return-Path (if set) for relay bounces",
"type": "string"
},
"SMTPServer": {
"description": "The configured SMTP server address",
"type": "string"
}
}
},
"SpamAssassin": {
"description": "Whether SpamAssassin is enabled",
"type": "boolean"
}
},
"x-go-package": "github.com/axllent/mailpit/server/apiv1"
}
},
"responses": {
@@ -2062,63 +2123,7 @@
"WebUIConfigurationResponse": {
"description": "Web UI configuration response",
"schema": {
"type": "object",
"properties": {
"ChaosEnabled": {
"description": "Whether Chaos support is enabled at runtime",
"type": "boolean"
},
"DuplicatesIgnored": {
"description": "Whether messages with duplicate IDs are ignored",
"type": "boolean"
},
"HideDeleteAllButton": {
"description": "Whether the delete button should be hidden",
"type": "boolean"
},
"Label": {
"description": "Optional label to identify this Mailpit instance",
"type": "string"
},
"MessageRelay": {
"description": "Message Relay information",
"type": "object",
"properties": {
"AllowedRecipients": {
"description": "Only allow relaying to these recipients (regex)",
"type": "string"
},
"BlockedRecipients": {
"description": "Block relaying to these recipients (regex)",
"type": "string"
},
"Enabled": {
"description": "Whether message relaying (release) is enabled",
"type": "boolean"
},
"OverrideFrom": {
"description": "Overrides the \"From\" address for all relayed messages",
"type": "string"
},
"PreserveMessageIDs": {
"description": "Preserve the original Message-IDs when relaying messages",
"type": "boolean"
},
"ReturnPath": {
"description": "Enforced Return-Path (if set) for relay bounces",
"type": "string"
},
"SMTPServer": {
"description": "The configured SMTP server address",
"type": "string"
}
}
},
"SpamAssassin": {
"description": "Whether SpamAssassin is enabled",
"type": "boolean"
}
}
"$ref": "#/definitions/WebUIConfiguration"
}
}
}