Merge pull request #175 from anchore/fix-json-keys

Change kebab case to camelCase in json keys throughout app
This commit is contained in:
Sam Dacanay 2020-09-18 09:19:37 -07:00 committed by GitHub
commit 1866949eff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 105 additions and 105 deletions

View File

@ -4,7 +4,7 @@
"artifacts": { "artifacts": {
"items": { "items": {
"properties": { "properties": {
"found-by": { "foundBy": {
"items": { "items": {
"type": "string" "type": "string"
}, },
@ -18,7 +18,7 @@
}, },
{ {
"properties": { "properties": {
"layer-index": { "layerIndex": {
"type": "integer" "type": "integer"
}, },
"path": { "path": {
@ -26,7 +26,7 @@
} }
}, },
"required": [ "required": [
"layer-index", "layerIndex",
"path" "path"
], ],
"type": "object" "type": "object"
@ -52,10 +52,10 @@
"checksum": { "checksum": {
"type": "string" "type": "string"
}, },
"owner-gid": { "ownerGid": {
"type": "string" "type": "string"
}, },
"owner-uid": { "ownerUid": {
"type": "string" "type": "string"
}, },
"path": { "path": {
@ -67,8 +67,8 @@
}, },
"required": [ "required": [
"checksum", "checksum",
"owner-gid", "ownerGid",
"owner-uid", "ownerUid",
"path", "path",
"permissions" "permissions"
], ],
@ -76,10 +76,10 @@
}, },
"type": "array" "type": "array"
}, },
"git-commit-of-apk-port": { "gitCommitOfApkPort": {
"type": "string" "type": "string"
}, },
"installed-size": { "installedSize": {
"type": "integer" "type": "integer"
}, },
"license": { "license": {
@ -95,7 +95,7 @@
}, },
{ {
"properties": { "properties": {
"extra-fields": { "extraFields": {
"properties": { "properties": {
"Archiver-Version": { "Archiver-Version": {
"type": "string" "type": "string"
@ -160,60 +160,60 @@
], ],
"type": "object" "type": "object"
}, },
"implementation-title": { "implementationTitle": {
"type": "string" "type": "string"
}, },
"implementation-vendor": { "implementationVendor": {
"type": "string" "type": "string"
}, },
"implementation-version": { "implementationVersion": {
"type": "string" "type": "string"
}, },
"manifest-version": { "manifestVersion": {
"type": "string" "type": "string"
}, },
"name": { "name": {
"type": "string" "type": "string"
}, },
"specification-title": { "specificationTitle": {
"type": "string" "type": "string"
}, },
"specification-vendor": { "specificationVendor": {
"type": "string" "type": "string"
}, },
"specification-version": { "specificationVersion": {
"type": "string" "type": "string"
} }
}, },
"required": [ "required": [
"extra-fields", "extraFields",
"implementation-title", "implementationTitle",
"implementation-vendor", "implementationVendor",
"implementation-version", "implementationVersion",
"manifest-version", "manifestVersion",
"name", "name",
"specification-title", "specificationTitle",
"specification-vendor", "specificationVendor",
"specification-version" "specificationVersion"
], ],
"type": "object" "type": "object"
} }
] ]
}, },
"origin-package": { "originPackage": {
"type": "string" "type": "string"
}, },
"package": { "package": {
"type": "string" "type": "string"
}, },
"parent-package": { "parentPackage": {
"anyOf": [ "anyOf": [
{ {
"type": "null" "type": "null"
}, },
{ {
"properties": { "properties": {
"found-by": { "foundBy": {
"type": "string" "type": "string"
}, },
"language": { "language": {
@ -229,7 +229,7 @@
"properties": { "properties": {
"manifest": { "manifest": {
"properties": { "properties": {
"extra-fields": { "extraFields": {
"properties": { "properties": {
"Archiver-Version": { "Archiver-Version": {
"type": "string" "type": "string"
@ -294,59 +294,59 @@
], ],
"type": "object" "type": "object"
}, },
"implementation-title": { "implementationTitle": {
"type": "string" "type": "string"
}, },
"implementation-vendor": { "implementationVendor": {
"type": "string" "type": "string"
}, },
"implementation-version": { "implementationVersion": {
"type": "string" "type": "string"
}, },
"manifest-version": { "manifestVersion": {
"type": "string" "type": "string"
}, },
"name": { "name": {
"type": "string" "type": "string"
}, },
"specification-title": { "specificationTitle": {
"type": "string" "type": "string"
}, },
"specification-vendor": { "specificationVendor": {
"type": "string" "type": "string"
}, },
"specification-version": { "specificationVersion": {
"type": "string" "type": "string"
} }
}, },
"required": [ "required": [
"extra-fields", "extraFields",
"implementation-title", "implementationTitle",
"implementation-vendor", "implementationVendor",
"implementation-version", "implementationVersion",
"manifest-version", "manifestVersion",
"name", "name",
"specification-title", "specificationTitle",
"specification-vendor", "specificationVendor",
"specification-version" "specificationVersion"
], ],
"type": "object" "type": "object"
}, },
"parent-package": { "parentPackage": {
"type": "null" "type": "null"
}, },
"pom-properties": { "pomProperties": {
"properties": { "properties": {
"Path": { "Path": {
"type": "string" "type": "string"
}, },
"artifact-id": { "artifactId": {
"type": "string" "type": "string"
}, },
"extra-fields": { "extraFields": {
"type": "null" "type": "null"
}, },
"group-id": { "groupId": {
"type": "string" "type": "string"
}, },
"name": { "name": {
@ -358,9 +358,9 @@
}, },
"required": [ "required": [
"Path", "Path",
"artifact-id", "artifactId",
"extra-fields", "extraFields",
"group-id", "groupId",
"name", "name",
"version" "version"
], ],
@ -369,8 +369,8 @@
}, },
"required": [ "required": [
"manifest", "manifest",
"parent-package", "parentPackage",
"pom-properties" "pomProperties"
], ],
"type": "object" "type": "object"
}, },
@ -385,7 +385,7 @@
} }
}, },
"required": [ "required": [
"found-by", "foundBy",
"language", "language",
"licenses", "licenses",
"manifest", "manifest",
@ -398,18 +398,18 @@
} }
] ]
}, },
"pom-properties": { "pomProperties": {
"properties": { "properties": {
"Path": { "Path": {
"type": "string" "type": "string"
}, },
"artifact-id": { "artifactId": {
"type": "string" "type": "string"
}, },
"extra-fields": { "extraFields": {
"type": "null" "type": "null"
}, },
"group-id": { "groupId": {
"type": "string" "type": "string"
}, },
"name": { "name": {
@ -421,18 +421,18 @@
}, },
"required": [ "required": [
"Path", "Path",
"artifact-id", "artifactId",
"extra-fields", "extraFields",
"group-id", "groupId",
"name", "name",
"version" "version"
], ],
"type": "object" "type": "object"
}, },
"pull-checksum": { "pullChecksum": {
"type": "string" "type": "string"
}, },
"pull-dependencies": { "pullDependencies": {
"type": "string" "type": "string"
}, },
"release": { "release": {
@ -464,7 +464,7 @@
} }
}, },
"required": [ "required": [
"found-by", "foundBy",
"locations", "locations",
"name", "name",
"type", "type",
@ -488,7 +488,7 @@
"digest": { "digest": {
"type": "string" "type": "string"
}, },
"media-type": { "mediaType": {
"type": "string" "type": "string"
}, },
"size": { "size": {
@ -497,14 +497,14 @@
}, },
"required": [ "required": [
"digest", "digest",
"media-type", "mediaType",
"size" "size"
], ],
"type": "object" "type": "object"
}, },
"type": "array" "type": "array"
}, },
"media-type": { "mediaType": {
"type": "string" "type": "string"
}, },
"size": { "size": {
@ -520,7 +520,7 @@
"required": [ "required": [
"digest", "digest",
"layers", "layers",
"media-type", "mediaType",
"size", "size",
"tags" "tags"
], ],

View File

@ -7,7 +7,7 @@ import (
// ApkMetadata represents all captured data for a Alpine DB package entry. See https://wiki.alpinelinux.org/wiki/Apk_spec for more information. // ApkMetadata represents all captured data for a Alpine DB package entry. See https://wiki.alpinelinux.org/wiki/Apk_spec for more information.
type ApkMetadata struct { type ApkMetadata struct {
Package string `mapstructure:"P" json:"package"` Package string `mapstructure:"P" json:"package"`
OriginPackage string `mapstructure:"o" json:"origin-package"` OriginPackage string `mapstructure:"o" json:"originPackage"`
Maintainer string `mapstructure:"m" json:"maintainer"` Maintainer string `mapstructure:"m" json:"maintainer"`
Version string `mapstructure:"V" json:"version"` Version string `mapstructure:"V" json:"version"`
License string `mapstructure:"L" json:"license"` License string `mapstructure:"L" json:"license"`
@ -15,18 +15,18 @@ type ApkMetadata struct {
URL string `mapstructure:"U" json:"url"` URL string `mapstructure:"U" json:"url"`
Description string `mapstructure:"T" json:"description"` Description string `mapstructure:"T" json:"description"`
Size int `mapstructure:"S" json:"size"` Size int `mapstructure:"S" json:"size"`
InstalledSize int `mapstructure:"I" json:"installed-size"` InstalledSize int `mapstructure:"I" json:"installedSize"`
PullDependencies string `mapstructure:"D" json:"pull-dependencies"` PullDependencies string `mapstructure:"D" json:"pullDependencies"`
PullChecksum string `mapstructure:"C" json:"pull-checksum"` PullChecksum string `mapstructure:"C" json:"pullChecksum"`
GitCommitOfAport string `mapstructure:"c" json:"git-commit-of-apk-port"` GitCommitOfAport string `mapstructure:"c" json:"gitCommitOfApkPort"`
Files []ApkFileRecord `json:"files"` Files []ApkFileRecord `json:"files"`
} }
// ApkFileRecord represents a single file listing and metadata from a APK DB entry (which may have many of these file records). // ApkFileRecord represents a single file listing and metadata from a APK DB entry (which may have many of these file records).
type ApkFileRecord struct { type ApkFileRecord struct {
Path string `json:"path"` Path string `json:"path"`
OwnerUID string `json:"owner-uid"` OwnerUID string `json:"ownerUid"`
OwnerGUI string `json:"owner-gid"` OwnerGUI string `json:"ownerGid"`
Permissions string `json:"permissions"` Permissions string `json:"permissions"`
Checksum string `json:"checksum"` Checksum string `json:"checksum"`
} }

View File

@ -5,31 +5,31 @@ import "github.com/package-url/packageurl-go"
// JavaMetadata encapsulates all Java ecosystem metadata for a package as well as an (optional) parent relationship. // JavaMetadata encapsulates all Java ecosystem metadata for a package as well as an (optional) parent relationship.
type JavaMetadata struct { type JavaMetadata struct {
Manifest *JavaManifest `mapstructure:"Manifest" json:"manifest"` Manifest *JavaManifest `mapstructure:"Manifest" json:"manifest"`
PomProperties *PomProperties `mapstructure:"PomProperties" json:"pom-properties"` PomProperties *PomProperties `mapstructure:"PomProperties" json:"pomProperties"`
Parent *Package `json:"parent-package"` // TODO: should this be included in the json output? Parent *Package `json:"parentPackage"` // TODO: should this be included in the json output?
} }
// PomProperties represents the fields of interest extracted from a Java archive's pom.xml file. // PomProperties represents the fields of interest extracted from a Java archive's pom.xml file.
type PomProperties struct { type PomProperties struct {
Path string Path string
Name string `mapstructure:"name" json:"name"` Name string `mapstructure:"name" json:"name"`
GroupID string `mapstructure:"groupId" json:"group-id"` GroupID string `mapstructure:"groupId" json:"groupId"`
ArtifactID string `mapstructure:"artifactId" json:"artifact-id"` ArtifactID string `mapstructure:"artifactId" json:"artifactId"`
Version string `mapstructure:"version" json:"version"` Version string `mapstructure:"version" json:"version"`
Extra map[string]string `mapstructure:",remain" json:"extra-fields"` Extra map[string]string `mapstructure:",remain" json:"extraFields"`
} }
// JavaManifest represents the fields of interest extracted from a Java archive's META-INF/MANIFEST.MF file. // JavaManifest represents the fields of interest extracted from a Java archive's META-INF/MANIFEST.MF file.
type JavaManifest struct { type JavaManifest struct {
Name string `mapstructure:"Name" json:"name"` Name string `mapstructure:"Name" json:"name"`
ManifestVersion string `mapstructure:"Manifest-Version" json:"manifest-version"` ManifestVersion string `mapstructure:"Manifest-Version" json:"manifestVersion"`
SpecTitle string `mapstructure:"Specification-Title" json:"specification-title"` SpecTitle string `mapstructure:"Specification-Title" json:"specificationTitle"`
SpecVersion string `mapstructure:"Specification-Version" json:"specification-version"` SpecVersion string `mapstructure:"Specification-Version" json:"specificationVersion"`
SpecVendor string `mapstructure:"Specification-Vendor" json:"specification-vendor"` SpecVendor string `mapstructure:"Specification-Vendor" json:"specificationVendor"`
ImplTitle string `mapstructure:"Implementation-Title" json:"implementation-title"` ImplTitle string `mapstructure:"Implementation-Title" json:"implementationTitle"`
ImplVersion string `mapstructure:"Implementation-Version" json:"implementation-version"` ImplVersion string `mapstructure:"Implementation-Version" json:"implementationVersion"`
ImplVendor string `mapstructure:"Implementation-Vendor" json:"implementation-vendor"` ImplVendor string `mapstructure:"Implementation-Vendor" json:"implementationVendor"`
Extra map[string]string `mapstructure:",remain" json:"extra-fields"` Extra map[string]string `mapstructure:",remain" json:"extraFields"`
} }
func (m JavaMetadata) PackageURL() string { func (m JavaMetadata) PackageURL() string {

View File

@ -20,7 +20,7 @@ type Package struct {
id ID // uniquely identifies a package, set by the cataloger id ID // uniquely identifies a package, set by the cataloger
Name string `json:"manifest"` // the package name Name string `json:"manifest"` // the package name
Version string `json:"version"` // the version of the package Version string `json:"version"` // the version of the package
FoundBy string `json:"found-by"` // the specific cataloger that discovered this package FoundBy string `json:"foundBy"` // the specific cataloger that discovered this package
Source []file.Reference `json:"sources"` // the locations that lead to the discovery of this package (note: this is not necessarily the locations that make up this package) Source []file.Reference `json:"sources"` // the locations that lead to the discovery of this package (note: this is not necessarily the locations that make up this package)
// TODO: should we move licenses into metadata? // TODO: should we move licenses into metadata?
Licenses []string `json:"licenses"` // licenses discovered with the package metadata Licenses []string `json:"licenses"` // licenses discovered with the package metadata

View File

@ -14,7 +14,7 @@ type RpmMetadata struct {
Epoch int `json:"epoch"` Epoch int `json:"epoch"`
Arch string `json:"architecture"` Arch string `json:"architecture"`
Release string `json:"release"` Release string `json:"release"`
SourceRpm string `json:"source-rpm"` SourceRpm string `json:"sourceRpm"`
Size int `json:"size"` Size int `json:"size"`
License string `json:"license"` License string `json:"license"`
Vendor string `json:"vendor"` Vendor string `json:"vendor"`

View File

@ -9,7 +9,7 @@ type Artifact struct {
Name string `json:"name"` Name string `json:"name"`
Version string `json:"version"` Version string `json:"version"`
Type string `json:"type"` Type string `json:"type"`
FoundBy []string `json:"found-by"` FoundBy []string `json:"foundBy"`
Locations Locations `json:"locations,omitempty"` Locations Locations `json:"locations,omitempty"`
Metadata interface{} `json:"metadata,omitempty"` Metadata interface{} `json:"metadata,omitempty"`
} }

View File

@ -6,12 +6,12 @@ type Image struct {
Layers []Layer `json:"layers"` Layers []Layer `json:"layers"`
Size int64 `json:"size"` Size int64 `json:"size"`
Digest string `json:"digest"` Digest string `json:"digest"`
MediaType string `json:"media-type"` MediaType string `json:"mediaType"`
Tags []string `json:"tags"` Tags []string `json:"tags"`
} }
type Layer struct { type Layer struct {
MediaType string `json:"media-type"` MediaType string `json:"mediaType"`
Digest string `json:"digest"` Digest string `json:"digest"`
Size int64 `json:"size"` Size int64 `json:"size"`
} }

View File

@ -11,7 +11,7 @@ type Locations interface{}
type ImageLocation struct { type ImageLocation struct {
Path string `json:"path"` Path string `json:"path"`
LayerIndex uint `json:"layer-index"` LayerIndex uint `json:"layerIndex"`
} }
func NewLocations(p *pkg.Package, s scope.Scope) (Locations, error) { func NewLocations(p *pkg.Package, s scope.Scope) (Locations, error) {

View File

@ -4,7 +4,7 @@
"name": "package-1", "name": "package-1",
"version": "1.0.1", "version": "1.0.1",
"type": "deb", "type": "deb",
"found-by": [ "foundBy": [
"the-cataloger-1" "the-cataloger-1"
], ],
"locations": [ "locations": [
@ -15,7 +15,7 @@
"name": "package-2", "name": "package-2",
"version": "2.0.1", "version": "2.0.1",
"type": "deb", "type": "deb",
"found-by": [ "foundBy": [
"the-cataloger-2" "the-cataloger-2"
], ],
"locations": [ "locations": [

View File

@ -4,13 +4,13 @@
"name": "package-1", "name": "package-1",
"version": "1.0.1", "version": "1.0.1",
"type": "deb", "type": "deb",
"found-by": [ "foundBy": [
"the-cataloger-1" "the-cataloger-1"
], ],
"locations": [ "locations": [
{ {
"path": "/somefile-1.txt", "path": "/somefile-1.txt",
"layer-index": 0 "layerIndex": 0
} }
] ]
}, },
@ -18,13 +18,13 @@
"name": "package-2", "name": "package-2",
"version": "2.0.1", "version": "2.0.1",
"type": "deb", "type": "deb",
"found-by": [ "foundBy": [
"the-cataloger-2" "the-cataloger-2"
], ],
"locations": [ "locations": [
{ {
"path": "/somefile-2.txt", "path": "/somefile-2.txt",
"layer-index": 1 "layerIndex": 1
} }
] ]
} }
@ -32,24 +32,24 @@
"image": { "image": {
"layers": [ "layers": [
{ {
"media-type": "application/vnd.docker.image.rootfs.diff.tar.gzip", "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"digest": "sha256:056c0789fa9ad629ceae6d09713fb035f84115af3c4a88a43aa60f13bc683053", "digest": "sha256:056c0789fa9ad629ceae6d09713fb035f84115af3c4a88a43aa60f13bc683053",
"size": 22 "size": 22
}, },
{ {
"media-type": "application/vnd.docker.image.rootfs.diff.tar.gzip", "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"digest": "sha256:b461c48116592c570a66fed71d5b09662a8172e168b7938cf317af47872cdc9b", "digest": "sha256:b461c48116592c570a66fed71d5b09662a8172e168b7938cf317af47872cdc9b",
"size": 16 "size": 16
}, },
{ {
"media-type": "application/vnd.docker.image.rootfs.diff.tar.gzip", "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
"digest": "sha256:00b80053e05c01da485015610d288ce3185fac00d251e2ada02b45a7a7c5f589", "digest": "sha256:00b80053e05c01da485015610d288ce3185fac00d251e2ada02b45a7a7c5f589",
"size": 27 "size": 27
} }
], ],
"size": 65, "size": 65,
"digest": "sha256:3c53d2d891940f8d8e95acb77b58752f54dc5de9d91d19dd90ced2db76256cea", "digest": "sha256:3c53d2d891940f8d8e95acb77b58752f54dc5de9d91d19dd90ced2db76256cea",
"media-type": "application/vnd.docker.distribution.manifest.v2+json", "mediaType": "application/vnd.docker.distribution.manifest.v2+json",
"tags": [ "tags": [
"anchore-fixture-image-simple:04e16e44161c8888a1a963720fd0443cbf7eef8101434c431de8725cd98cc9f7" "anchore-fixture-image-simple:04e16e44161c8888a1a963720fd0443cbf7eef8101434c431de8725cd98cc9f7"
] ]