mirror of
https://github.com/anchore/syft.git
synced 2026-11-04 00:16:38 +01:00
Align SPDX export more with SPDX 2.2 specification (#743)
This commit is contained in:
@@ -3,7 +3,7 @@ package model
|
||||
type Element struct {
|
||||
SPDXID string `json:"SPDXID"`
|
||||
// Identify name of this SpdxElement.
|
||||
Name string `json:"name"`
|
||||
Name string `json:"name,omitempty"`
|
||||
// Relationships referenced in the SPDX document
|
||||
Relationships []Relationship `json:"relationships,omitempty"`
|
||||
// Provide additional information about an SpdxElement.
|
||||
|
||||
@@ -2,7 +2,6 @@ package spdx22json
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -131,8 +130,7 @@ func toFiles(s sbom.SBOM) []model.File {
|
||||
results = append(results, model.File{
|
||||
Item: model.Item{
|
||||
Element: model.Element{
|
||||
SPDXID: string(coordinates.ID()),
|
||||
Name: filepath.Base(coordinates.RealPath),
|
||||
SPDXID: model.ElementID(coordinates.ID()).String(),
|
||||
Comment: comment,
|
||||
},
|
||||
// required, no attempt made to determine license information
|
||||
@@ -206,9 +204,9 @@ func toRelationships(relationships []artifact.Relationship) (result []model.Rela
|
||||
}
|
||||
|
||||
result = append(result, model.Relationship{
|
||||
SpdxElementID: string(r.From.ID()),
|
||||
SpdxElementID: model.ElementID(r.From.ID()).String(),
|
||||
RelationshipType: relationshipType,
|
||||
RelatedSpdxElement: string(r.To.ID()),
|
||||
RelatedSpdxElement: model.ElementID(r.To.ID()).String(),
|
||||
Comment: comment,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user