mirror of
https://github.com/anchore/syft.git
synced 2026-11-02 23:46:35 +01:00
Improve struct and field comments and incorporate into json schema (#4252)
* improve struct and field comments and incorporate into json schema Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> * address review feedback Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com> --------- Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
This commit is contained in:
+27
-8
@@ -2,23 +2,42 @@ package pkg
|
||||
|
||||
// NpmPackage represents the contents of a javascript package.json file.
|
||||
type NpmPackage struct {
|
||||
Name string `mapstructure:"name" json:"name"`
|
||||
Version string `mapstructure:"version" json:"version"`
|
||||
Author string `mapstructure:"author" json:"author"`
|
||||
Homepage string `mapstructure:"homepage" json:"homepage"`
|
||||
// Name is the package name as found in package.json
|
||||
Name string `mapstructure:"name" json:"name"`
|
||||
|
||||
// Version is the package version as found in package.json
|
||||
Version string `mapstructure:"version" json:"version"`
|
||||
|
||||
// Author is package author name
|
||||
Author string `mapstructure:"author" json:"author"`
|
||||
|
||||
// Homepage is project homepage URL
|
||||
Homepage string `mapstructure:"homepage" json:"homepage"`
|
||||
|
||||
// Description is a human-readable package description
|
||||
Description string `mapstructure:"description" json:"description"`
|
||||
URL string `mapstructure:"url" json:"url"`
|
||||
Private bool `mapstructure:"private" json:"private"`
|
||||
|
||||
// URL is repository or project URL
|
||||
URL string `mapstructure:"url" json:"url"`
|
||||
|
||||
// Private is whether this is a private package
|
||||
Private bool `mapstructure:"private" json:"private"`
|
||||
}
|
||||
|
||||
// NpmPackageLockEntry represents a single entry within the "packages" section of a package-lock.json file.
|
||||
type NpmPackageLockEntry struct {
|
||||
Resolved string `mapstructure:"resolved" json:"resolved"`
|
||||
// Resolved is URL where this package was downloaded from (registry source)
|
||||
Resolved string `mapstructure:"resolved" json:"resolved"`
|
||||
|
||||
// Integrity is Subresource Integrity hash for verification using standard SRI format (sha512-... or sha1-...). npm changed from SHA-1 to SHA-512 in newer versions. For registry sources this is the integrity from registry, for remote tarballs it's SHA-512 of the file. npm verifies tarball matches this hash before unpacking, throwing EINTEGRITY error if mismatch detected.
|
||||
Integrity string `mapstructure:"integrity" json:"integrity"`
|
||||
}
|
||||
|
||||
// YarnLockEntry represents a single entry section of a yarn.lock file.
|
||||
type YarnLockEntry struct {
|
||||
Resolved string `mapstructure:"resolved" json:"resolved"`
|
||||
// Resolved is URL where this package was downloaded from
|
||||
Resolved string `mapstructure:"resolved" json:"resolved"`
|
||||
|
||||
// Integrity is Subresource Integrity hash for verification (SRI format)
|
||||
Integrity string `mapstructure:"integrity" json:"integrity"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user