mirror of
https://github.com/anchore/syft.git
synced 2025-11-18 08:53:15 +01:00
fix: update syftjson ID to match major schema version (#1274)
This commit is contained in:
parent
d3ee24017e
commit
ec229b993c
@ -4,7 +4,7 @@ import (
|
|||||||
"github.com/anchore/syft/syft/sbom"
|
"github.com/anchore/syft/syft/sbom"
|
||||||
)
|
)
|
||||||
|
|
||||||
const ID sbom.FormatID = "syft-3-json"
|
const ID sbom.FormatID = "syft-4-json"
|
||||||
|
|
||||||
func Format() sbom.Format {
|
func Format() sbom.Format {
|
||||||
return sbom.NewFormat(
|
return sbom.NewFormat(
|
||||||
|
|||||||
@ -1,16 +1,24 @@
|
|||||||
package syftjson
|
package syftjson
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/scylladb/go-set/strset"
|
"github.com/scylladb/go-set/strset"
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/anchore/syft/internal"
|
||||||
"github.com/anchore/syft/syft/formats/syftjson/model"
|
"github.com/anchore/syft/syft/formats/syftjson/model"
|
||||||
"github.com/anchore/syft/syft/source"
|
"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) {
|
func Test_toSourceModel(t *testing.T) {
|
||||||
allSchemes := strset.New()
|
allSchemes := strset.New()
|
||||||
for _, s := range source.AllSchemes {
|
for _, s := range source.AllSchemes {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user