From ce100b7d88c1efd36337d1e45ccacd8b6d4f065c Mon Sep 17 00:00:00 2001 From: Owen Rumney Date: Sun, 14 May 2023 16:03:28 +0100 Subject: [PATCH] fix: Update the version URLs (#59) URL for v2.1.0 goes to the rtm5 URL rather than the final specification. Updated the schemas to add the option to use 210RTM5 or 210Final Signed-off-by: Owen Rumney --- v2/sarif/sarif.go | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/v2/sarif/sarif.go b/v2/sarif/sarif.go index 8e74627..055aa9f 100644 --- a/v2/sarif/sarif.go +++ b/v2/sarif/sarif.go @@ -12,10 +12,14 @@ import ( type Version string // Version210 represents Version210 of Sarif -const Version210 Version = "2.1.0" +const ( + Version210 Version = "2.1.0" + Version210RTM5 Version = "2.1.0-rtm.5" +) var versions = map[Version]string{ - Version210: "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", + Version210: "https://json.schemastore.org/sarif-2.1.0.json", + Version210RTM5: "https://json.schemastore.org/sarif-2.1.0-rtm.5.json", } // Report is the encapsulating type representing a Sarif Report @@ -28,17 +32,17 @@ type Report struct { } // New Creates a new Report or returns an error -func New(version Version, includeSchema... bool) (*Report, error) { - schema := "" +func New(version Version, includeSchema ...bool) (*Report, error) { + schema := "" - if len(includeSchema) == 0 || includeSchema[0] { - var err error + if len(includeSchema) == 0 || includeSchema[0] { + var err error - schema, err = getVersionSchema(version) - if err != nil { - return nil, err - } - } + schema, err = getVersionSchema(version) + if err != nil { + return nil, err + } + } return &Report{ Version: string(version), Schema: schema,