Finalize structured diagnostic aggregation

This commit is contained in:
2026-08-27 16:40:17 +00:00
parent 480680b257
commit 4dbbf68051
112 changed files with 656 additions and 893 deletions

View File

@@ -50,12 +50,12 @@ func (v *Validator) Validate(_ context.Context, req contracts.TypedValidationReq
}
citedTexts[index] = citedText
}
warnings := make([]contracts.Warning, 0)
warnings := make([]diagnostics.Finding, 0)
for index, occurrence := range req.Value.Occurrences {
if shared.ContainsTokenSequence(citedTexts[index], occurrence.Name) {
continue
}
warnings = append(warnings, contracts.Warning{Scope: fmt.Sprintf("occurrences[%d]", index), ReasonCode: ReasonCode, Message: fmt.Sprintf("Location occurrence name %s was not found in cited source text", diagnostics.Quote(occurrence.Name))})
warnings = append(warnings, diagnostics.Finding{Scope: fmt.Sprintf("occurrences[%d]", index), ReasonCode: ReasonCode, Message: fmt.Sprintf("Location occurrence name %s was not found in cited source text", diagnostics.Quote(occurrence.Name))})
}
return diagnostics.DataQualityResult(warnings)
}