-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
extract SBOM output structs; share across tests
- Loading branch information
1 parent
6bec663
commit 5b4d81b
Showing
3 changed files
with
91 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package sbom_test | ||
|
||
/* A set of structs that are used to unmarshal SBOM JSON output in tests */ | ||
|
||
type license struct { | ||
License struct { | ||
Name string `json:"name"` | ||
} `json:"license"` | ||
} | ||
|
||
type component struct { | ||
Type string `json:"type"` | ||
Name string `json:"name"` | ||
Version string `json:"version"` | ||
Licenses []license `json:"licenses"` | ||
PURL string `json:"purl"` | ||
} | ||
|
||
type cdxOutput struct { | ||
BOMFormat string `json:"bomFormat"` | ||
SpecVersion string `json:"specVersion"` | ||
Metadata struct { | ||
Component struct { | ||
Type string `json:"type"` | ||
Name string `json:"name"` | ||
} `json:"component"` | ||
} `json:"metadata"` | ||
Components []component `json:"components"` | ||
} | ||
|
||
type artifact struct { | ||
Name string `json:"name"` | ||
Version string `json:"version"` | ||
Licenses []string `json:"licenses"` | ||
CPEs []string `json:"cpes"` | ||
PURL string `json:"purl"` | ||
} | ||
|
||
type syftOutput struct { | ||
Artifacts []artifact `json:"artifacts"` | ||
Source struct { | ||
Type string `json:"type"` | ||
Target string `json:"target"` | ||
} `json:"source"` | ||
Schema struct { | ||
Version string `json:"version"` | ||
} `json:"schema"` | ||
} | ||
|
||
type externalRef struct { | ||
Category string `json:"referenceCategory"` | ||
Locator string `json:"referenceLocator"` | ||
Type string `json:"referenceType"` | ||
} | ||
|
||
type pkg struct { | ||
ExternalRefs []externalRef `json:"externalRefs"` | ||
LicenseConcluded string `json:"licenseConcluded"` | ||
LicenseDeclared string `json:"licenseDeclared"` | ||
Name string `json:"name"` | ||
Version string `json:"versionInfo"` | ||
} | ||
|
||
type spdxOutput struct { | ||
Packages []pkg `json:"packages"` | ||
SPDXVersion string `json:"spdxVersion"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters