Skip to content

Commit

Permalink
fix: Update the version URLs (#59)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
owenrumney authored May 14, 2023
1 parent 788062b commit ce100b7
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions v2/sarif/sarif.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit ce100b7

Please sign in to comment.