Merge RspamdSymbol into SpamTestDetail in OpenAPI spec
Add params field to SpamTestDetail, update RspamdResult.symbols to reference SpamTestDetail instead of the now-removed RspamdSymbol schema, and update Go code accordingly.
This commit is contained in:
parent
3c192f17fd
commit
5c104f3c99
3 changed files with 8 additions and 23 deletions
|
|
@ -59,7 +59,7 @@ func (a *RspamdAnalyzer) AnalyzeRspamd(email *EmailMessage) *api.RspamdResult {
|
|||
}
|
||||
|
||||
result := &api.RspamdResult{
|
||||
Symbols: make(map[string]api.RspamdSymbol),
|
||||
Symbols: make(map[string]api.SpamTestDetail),
|
||||
}
|
||||
|
||||
// Parse X-Spamd-Result header (primary source for score, threshold, and symbols)
|
||||
|
|
@ -129,7 +129,7 @@ func (a *RspamdAnalyzer) parseSpamdResult(header string, result *api.RspamdResul
|
|||
if len(matches) > 2 {
|
||||
name := matches[1]
|
||||
score, _ := strconv.ParseFloat(matches[2], 64)
|
||||
sym := api.RspamdSymbol{
|
||||
sym := api.SpamTestDetail{
|
||||
Name: name,
|
||||
Score: float32(score),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ func TestParseSpamdResult(t *testing.T) {
|
|||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
result := &api.RspamdResult{
|
||||
Symbols: make(map[string]api.RspamdSymbol),
|
||||
Symbols: make(map[string]api.SpamTestDetail),
|
||||
}
|
||||
analyzer.parseSpamdResult(tt.header, result)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue