Skip to content

Commit

Permalink
Add externalDocumentRefs to SPDX doc type (ko-build#741)
Browse files Browse the repository at this point in the history
This commit adds the `externalDocumentRefs` field to the SPDX document. These
will be required to link individual sboms.

Signed-off-by: Adolfo García Veytia (Puerco) <puerco@chainguard.dev>
  • Loading branch information
puerco authored Jul 1, 2022
1 parent 31d1c61 commit d17aca8
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions internal/sbom/spdx.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,17 @@ const (
)

type Document struct {
ID string `json:"SPDXID"`
Name string `json:"name"`
Version string `json:"spdxVersion"`
CreationInfo CreationInfo `json:"creationInfo"`
DataLicense string `json:"dataLicense"`
Namespace string `json:"documentNamespace"`
DocumentDescribes []string `json:"documentDescribes,omitempty"`
Files []File `json:"files,omitempty"`
Packages []Package `json:"packages,omitempty"`
Relationships []Relationship `json:"relationships,omitempty"`
ID string `json:"SPDXID"`
Name string `json:"name"`
Version string `json:"spdxVersion"`
CreationInfo CreationInfo `json:"creationInfo"`
DataLicense string `json:"dataLicense"`
Namespace string `json:"documentNamespace"`
DocumentDescribes []string `json:"documentDescribes,omitempty"`
Files []File `json:"files,omitempty"`
Packages []Package `json:"packages,omitempty"`
Relationships []Relationship `json:"relationships,omitempty"`
ExternalDocumentRefs []ExternalDocumentRef `json:"externalDocumentRefs,omitempty"`
}

type CreationInfo struct {
Expand Down Expand Up @@ -220,3 +221,9 @@ type Relationship struct {
Type string `json:"relationshipType"`
Related string `json:"relatedSpdxElement"`
}

type ExternalDocumentRef struct {
Checksum Checksum `json:"checksum"`
ExternalDocumentID string `json:"externalDocumentId"`
SPDXDocument string `json:"spdxDocument"`
}

0 comments on commit d17aca8

Please sign in to comment.