fix: update syftjson ID to match major schema version (#1274)

This commit is contained in:
Christopher Angelo Phillips 2022-10-19 12:08:38 -04:00 committed by GitHub
parent d3ee24017e
commit ec229b993c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View File

@ -4,7 +4,7 @@ import (
"github.com/anchore/syft/syft/sbom"
)
const ID sbom.FormatID = "syft-3-json"
const ID sbom.FormatID = "syft-4-json"
func Format() sbom.Format {
return sbom.NewFormat(

View File

@ -1,16 +1,24 @@
package syftjson
import (
"strings"
"testing"
"github.com/scylladb/go-set/strset"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/anchore/syft/internal"
"github.com/anchore/syft/syft/formats/syftjson/model"
"github.com/anchore/syft/syft/source"
)
func Test_SyftJsonID_Compatibility(t *testing.T) {
jsonMajorVersion := strings.Split(internal.JSONSchemaVersion, ".")[0]
syftJsonIDVersion := strings.Split(string(ID), "-")[1]
assert.Equal(t, jsonMajorVersion, syftJsonIDVersion)
}
func Test_toSourceModel(t *testing.T) {
allSchemes := strset.New()
for _, s := range source.AllSchemes {