diff --git a/schema/json/schema.json b/schema/json/schema.json index 440b271fc..0b32b6a65 100644 --- a/schema/json/schema.json +++ b/schema/json/schema.json @@ -53,62 +53,55 @@ "type": "integer" }, "files": { - "anyOf": [ - { - "type": "null" - }, - { - "items": { - "anyOf": [ - { + "items": { + "anyOf": [ + { + "type": "string" + }, + { + "properties": { + "checksum": { "type": "string" }, - { + "digest": { "properties": { - "checksum": { + "algorithm": { "type": "string" }, - "digest": { - "properties": { - "algorithm": { - "type": "string" - }, - "value": { - "type": "string" - } - }, - "required": [ - "algorithm", - "value" - ], - "type": "object" - }, - "ownerGid": { - "type": "string" - }, - "ownerUid": { - "type": "string" - }, - "path": { - "type": "string" - }, - "permissions": { - "type": "string" - }, - "size": { + "value": { "type": "string" } }, "required": [ - "path" + "algorithm", + "value" ], "type": "object" + }, + "ownerGid": { + "type": "string" + }, + "ownerUid": { + "type": "string" + }, + "path": { + "type": "string" + }, + "permissions": { + "type": "string" + }, + "size": { + "type": "string" } - ] - }, - "type": "array" - } - ] + }, + "required": [ + "path" + ], + "type": "object" + } + ] + }, + "type": "array" }, "gitCommitOfApkPort": { "type": "string" diff --git a/syft/pkg/npm_metadata.go b/syft/pkg/npm_metadata.go index bf53085a6..316404765 100644 --- a/syft/pkg/npm_metadata.go +++ b/syft/pkg/npm_metadata.go @@ -2,9 +2,7 @@ package pkg // NpmPackageJSONMetadata holds extra information that is used in pkg.Package type NpmPackageJSONMetadata struct { - Name string `mapstructure:"name" json:"name"` - Version string `mapstructure:"version" json:"version"` - Files []string `mapstructure:"files" json:"files"` + Files []string `mapstructure:"files" json:"files,omitempty"` Author string `mapstructure:"author" json:"author"` Licenses []string `mapstructure:"licenses" json:"licenses"` Homepage string `mapstructure:"homepage" json:"homepage"`