bump stereoscope to include functional options (#823)

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman
2022-02-14 20:40:51 -05:00
committed by GitHub
parent e1e9ccb401
commit 51c6eb30f5
6 changed files with 25 additions and 6 deletions
@@ -21,6 +21,10 @@ func TestEncodeDecodeCycle(t *testing.T) {
assert.NoError(t, err)
for _, d := range deep.Equal(originalSBOM.Source, actualSBOM.Source) {
if strings.HasSuffix(d, "<nil slice> != []") {
// semantically the same
continue
}
t.Errorf("metadata difference: %+v", d)
}
+9 -1
View File
@@ -217,9 +217,17 @@ func toRelationshipModel(relationships []artifact.Relationship) []model.Relation
func toSourceModel(src source.Metadata) (model.Source, error) {
switch src.Scheme {
case source.ImageScheme:
metadata := src.ImageMetadata
// ensure that empty collections are not shown as null
if metadata.RepoDigests == nil {
metadata.RepoDigests = []string{}
}
if metadata.Tags == nil {
metadata.Tags = []string{}
}
return model.Source{
Type: "image",
Target: src.ImageMetadata,
Target: metadata,
}, nil
case source.DirectoryScheme:
return model.Source{
@@ -63,6 +63,8 @@ func Test_toSourceModel(t *testing.T) {
ID: "id...",
ManifestDigest: "digest...",
MediaType: "type...",
RepoDigests: []string{},
Tags: []string{},
},
},
},