Normalize syft-json output (#1194)

This commit is contained in:
Scott Andrews
2022-09-07 10:56:49 -04:00
committed by GitHub
parent 586d3fe77f
commit 1c7b7c5f8a
3 changed files with 18 additions and 1 deletions
@@ -215,6 +215,15 @@ func toRelationshipModel(relationships []artifact.Relationship) []model.Relation
Metadata: r.Data,
}
}
sort.Slice(result, func(i, j int) bool {
if iParent, jParent := result[i].Parent, result[j].Parent; iParent != jParent {
return iParent < jParent
}
if iChild, jChild := result[i].Child, result[j].Child; iChild != jChild {
return iChild < jChild
}
return result[i].Type < result[j].Type
})
return result
}