From d6ad5dd24209f7a33c759ed84275f5737d3e22d3 Mon Sep 17 00:00:00 2001 From: Luke Watts Date: Wed, 10 Apr 2024 15:43:08 +0200 Subject: [PATCH] fix: extract sarif document to named Struct for reuse CLI-265 --- sarif/sarif_types.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/sarif/sarif_types.go b/sarif/sarif_types.go index 34e82603..73044503 100644 --- a/sarif/sarif_types.go +++ b/sarif/sarif_types.go @@ -17,7 +17,13 @@ //nolint:revive,tagliatelle // These are all SARIF documented types that need to match the exact JSON format. package sarif -// SarifResponse matches the spec in https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/schemas/sarif-schema-2.1.0.json +// SarifDocument matches the spec in https://docs.oasis-open.org/sarif/sarif/v2.1.0/os/schemas/sarif-schema-2.1.0.json +type SarifDocument struct { + Schema string `json:"$schema"` + Version string `json:"version"` + Runs []Run `json:"runs"` +} + type SarifResponse struct { Type string `json:"type"` Progress float64 `json:"progress"` @@ -32,11 +38,7 @@ type SarifResponse struct { IsSupported bool `json:"isSupported"` Lang string `json:"lang"` } `json:"coverage"` - Sarif struct { - Schema string `json:"$schema"` - Version string `json:"version"` - Runs []Run `json:"runs"` - } `json:"sarif"` + Sarif SarifDocument `json:"sarif"` } type region struct {