mirror of
https://github.com/anchore/syft.git
synced 2026-10-31 14:36:33 +01:00
finalize json output & add schema (#118)
This commit is contained in:
+47
-38
@@ -1,61 +1,70 @@
|
||||
package pkg
|
||||
|
||||
// TODO: consider keeping the remaining values as an embedded map
|
||||
// Available fields are described at http://manpages.ubuntu.com/manpages/xenial/man1/dpkg-query.1.html
|
||||
// in the --showformat section
|
||||
type DpkgMetadata struct {
|
||||
Package string `mapstructure:"Package"`
|
||||
Source string `mapstructure:"Source"`
|
||||
Version string `mapstructure:"Version"`
|
||||
Package string `mapstructure:"Package" json:"package"`
|
||||
Source string `mapstructure:"Source" json:"source"`
|
||||
Version string `mapstructure:"Version" json:"version"`
|
||||
// TODO: consider keeping the remaining values as an embedded map
|
||||
}
|
||||
|
||||
type RpmMetadata struct {
|
||||
Epoch int `mapstructure:"Epoch"`
|
||||
Arch string `mapstructure:"Arch"`
|
||||
Release string `mapstructure:"Release"`
|
||||
Epoch int `mapstructure:"Epoch" json:"epoch"`
|
||||
Arch string `mapstructure:"Arch" json:"architecture"`
|
||||
Release string `mapstructure:"Release" json:"release"`
|
||||
// TODO: consider keeping the remaining values as an embedded map
|
||||
}
|
||||
|
||||
type JavaManifest struct {
|
||||
Name string `mapstructure:"Name"`
|
||||
ManifestVersion string `mapstructure:"Manifest-Version"`
|
||||
SpecTitle string `mapstructure:"Specification-Title"`
|
||||
SpecVersion string `mapstructure:"Specification-Version"`
|
||||
SpecVendor string `mapstructure:"Specification-Vendor"`
|
||||
ImplTitle string `mapstructure:"Implementation-Title"`
|
||||
ImplVersion string `mapstructure:"Implementation-Version"`
|
||||
ImplVendor string `mapstructure:"Implementation-Vendor"`
|
||||
Extra map[string]string `mapstructure:",remain"`
|
||||
Name string `mapstructure:"Name" json:"name"`
|
||||
ManifestVersion string `mapstructure:"Manifest-Version" json:"manifest-version"`
|
||||
SpecTitle string `mapstructure:"Specification-Title" json:"specification-title"`
|
||||
SpecVersion string `mapstructure:"Specification-Version" json:"specification-version"`
|
||||
SpecVendor string `mapstructure:"Specification-Vendor" json:"specification-vendor"`
|
||||
ImplTitle string `mapstructure:"Implementation-Title" json:"implementation-title"`
|
||||
ImplVersion string `mapstructure:"Implementation-Version" json:"implementation-version"`
|
||||
ImplVendor string `mapstructure:"Implementation-Vendor" json:"implementation-vendor"`
|
||||
Extra map[string]string `mapstructure:",remain" json:"extra-fields"`
|
||||
}
|
||||
|
||||
type PomProperties struct {
|
||||
Path string
|
||||
Name string `mapstructure:"name"`
|
||||
GroupID string `mapstructure:"groupId"`
|
||||
ArtifactID string `mapstructure:"artifactId"`
|
||||
Version string `mapstructure:"version"`
|
||||
Extra map[string]string `mapstructure:",remain"`
|
||||
Name string `mapstructure:"name" json:"name"`
|
||||
GroupID string `mapstructure:"groupId" json:"group-id"`
|
||||
ArtifactID string `mapstructure:"artifactId" json:"artifact-id"`
|
||||
Version string `mapstructure:"version" json:"version"`
|
||||
Extra map[string]string `mapstructure:",remain" json:"extra-fields"`
|
||||
}
|
||||
|
||||
type JavaMetadata struct {
|
||||
Manifest *JavaManifest `mapstructure:"Manifest"`
|
||||
PomProperties *PomProperties `mapstructure:"PomProperties"`
|
||||
Parent *Package
|
||||
Manifest *JavaManifest `mapstructure:"Manifest" json:"manifest"`
|
||||
PomProperties *PomProperties `mapstructure:"PomProperties" json:"pom-properties"`
|
||||
Parent *Package `json:"parent-package"`
|
||||
}
|
||||
|
||||
// source: https://wiki.alpinelinux.org/wiki/Apk_spec
|
||||
type ApkMetadata struct {
|
||||
Package string `mapstructure:"P"`
|
||||
OriginPackage string `mapstructure:"o"`
|
||||
Maintainer string `mapstructure:"m"`
|
||||
Version string `mapstructure:"V"`
|
||||
License string `mapstructure:"L"`
|
||||
Architecture string `mapstructure:"A"`
|
||||
URL string `mapstructure:"U"`
|
||||
Description string `mapstructure:"T"`
|
||||
Size int `mapstructure:"S"`
|
||||
InstalledSize int `mapstructure:"I"`
|
||||
PullDependencies string `mapstructure:"D"`
|
||||
PullChecksum string `mapstructure:"C"`
|
||||
GitCommitOfAport string `mapstructure:"c"`
|
||||
Files []string
|
||||
Package string `mapstructure:"P" json:"package"`
|
||||
OriginPackage string `mapstructure:"o" json:"origin-package"`
|
||||
Maintainer string `mapstructure:"m" json:"maintainer"`
|
||||
Version string `mapstructure:"V" json:"version"`
|
||||
License string `mapstructure:"L" json:"license"`
|
||||
Architecture string `mapstructure:"A" json:"architecture"`
|
||||
URL string `mapstructure:"U" json:"url"`
|
||||
Description string `mapstructure:"T" json:"description"`
|
||||
Size int `mapstructure:"S" json:"size"`
|
||||
InstalledSize int `mapstructure:"I" json:"installed-size"`
|
||||
PullDependencies string `mapstructure:"D" json:"pull-dependencies"`
|
||||
PullChecksum string `mapstructure:"C" json:"pull-checksum"`
|
||||
GitCommitOfAport string `mapstructure:"c" json:"git-commit-of-apk-port"`
|
||||
Files []ApkFileRecord `json:"files"`
|
||||
}
|
||||
|
||||
type ApkFileRecord struct {
|
||||
Path string `json:"path"`
|
||||
OwnerUID string `json:"owner-uid"`
|
||||
OwnerGUI string `json:"owner-gid"`
|
||||
Permissions string `json:"permissions"`
|
||||
Checksum string `json:"checksum"`
|
||||
}
|
||||
|
||||
+9
-9
@@ -12,15 +12,15 @@ type ID int64
|
||||
|
||||
// Package represents an application or library that has been bundled into a distributable format
|
||||
type Package struct {
|
||||
id ID // this is set when a package is added to the catalog
|
||||
Name string
|
||||
Version string
|
||||
FoundBy string
|
||||
Source []file.Reference
|
||||
Licenses []string
|
||||
Language Language // TODO: should this support multiple languages as a slice?
|
||||
Type Type
|
||||
Metadata interface{}
|
||||
id ID // this is set when a package is added to the catalog
|
||||
Name string `json:"manifest"`
|
||||
Version string `json:"version"`
|
||||
FoundBy string `json:"found-by"`
|
||||
Source []file.Reference `json:"sources"`
|
||||
Licenses []string `json:"licenses"` // TODO: should we move this into metadata?
|
||||
Language Language `json:"language"` // TODO: should this support multiple languages as a slice?
|
||||
Type Type `json:"type"`
|
||||
Metadata interface{} `json:"metadata,omitempty"`
|
||||
}
|
||||
|
||||
func (p Package) ID() ID {
|
||||
|
||||
Reference in New Issue
Block a user