allow for optional fields in npm metadata

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman 2020-10-23 15:00:55 -04:00
parent 94ffc2caa8
commit 6eb36bc3c8
No known key found for this signature in database
GPG Key ID: 5CB45AE22BAB7EA7
2 changed files with 38 additions and 47 deletions

View File

@ -53,11 +53,6 @@
"type": "integer" "type": "integer"
}, },
"files": { "files": {
"anyOf": [
{
"type": "null"
},
{
"items": { "items": {
"anyOf": [ "anyOf": [
{ {
@ -107,8 +102,6 @@
] ]
}, },
"type": "array" "type": "array"
}
]
}, },
"gitCommitOfApkPort": { "gitCommitOfApkPort": {
"type": "string" "type": "string"

View File

@ -2,9 +2,7 @@ package pkg
// NpmPackageJSONMetadata holds extra information that is used in pkg.Package // NpmPackageJSONMetadata holds extra information that is used in pkg.Package
type NpmPackageJSONMetadata struct { type NpmPackageJSONMetadata struct {
Name string `mapstructure:"name" json:"name"` Files []string `mapstructure:"files" json:"files,omitempty"`
Version string `mapstructure:"version" json:"version"`
Files []string `mapstructure:"files" json:"files"`
Author string `mapstructure:"author" json:"author"` Author string `mapstructure:"author" json:"author"`
Licenses []string `mapstructure:"licenses" json:"licenses"` Licenses []string `mapstructure:"licenses" json:"licenses"`
Homepage string `mapstructure:"homepage" json:"homepage"` Homepage string `mapstructure:"homepage" json:"homepage"`