update json schema and test for java virtualPath

Signed-off-by: Alex Goodman <alex.goodman@anchore.com>
This commit is contained in:
Alex Goodman 2020-10-28 15:23:56 -04:00
parent 76c8f24090
commit 8bcba7d830
No known key found for this signature in database
GPG Key ID: 5CB45AE22BAB7EA7
3 changed files with 21 additions and 10 deletions

View File

@ -376,9 +376,6 @@
},
"pomProperties": {
"properties": {
"Path": {
"type": "string"
},
"artifactId": {
"type": "string"
},
@ -391,25 +388,32 @@
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"version": {
"type": "string"
}
},
"required": [
"Path",
"artifactId",
"extraFields",
"groupId",
"name",
"path",
"version"
],
"type": "object"
},
"virtualPath": {
"type": "string"
}
},
"required": [
"manifest",
"parentPackage",
"pomProperties"
"pomProperties",
"virtualPath"
],
"type": "object"
},
@ -446,9 +450,6 @@
},
"pomProperties": {
"properties": {
"Path": {
"type": "string"
},
"artifactId": {
"type": "string"
},
@ -461,16 +462,19 @@
"name": {
"type": "string"
},
"path": {
"type": "string"
},
"version": {
"type": "string"
}
},
"required": [
"Path",
"artifactId",
"extraFields",
"groupId",
"name",
"path",
"version"
],
"type": "object"
@ -510,6 +514,9 @@
},
"version": {
"type": "string"
},
"virtualPath": {
"type": "string"
}
},
"type": "object"

View File

@ -143,6 +143,7 @@ func TestParseJar(t *testing.T) {
Type: pkg.JenkinsPluginPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
VirtualPath: "test-fixtures/java-builds/packages/example-jenkins-plugin.hpi",
Manifest: &pkg.JavaManifest{
ManifestVersion: "1.0",
SpecTitle: "The Jenkins Plugins Parent POM Project",
@ -188,6 +189,7 @@ func TestParseJar(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
VirtualPath: "test-fixtures/java-builds/packages/example-java-app-gradle-0.1.0.jar",
Manifest: &pkg.JavaManifest{
ManifestVersion: "1.0",
},
@ -208,6 +210,7 @@ func TestParseJar(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
VirtualPath: "test-fixtures/java-builds/packages/example-java-app-maven-0.1.0.jar",
Manifest: &pkg.JavaManifest{
ManifestVersion: "1.0",
Extra: map[string]string{
@ -233,6 +236,7 @@ func TestParseJar(t *testing.T) {
Type: pkg.JavaPkg,
MetadataType: pkg.JavaMetadataType,
Metadata: pkg.JavaMetadata{
VirtualPath: "test-fixtures/java-builds/packages/example-java-app-maven-0.1.0.jar",
PomProperties: &pkg.PomProperties{
Path: "META-INF/maven/joda-time/joda-time/pom.properties",
GroupID: "joda-time",

View File

@ -4,7 +4,7 @@ import "github.com/package-url/packageurl-go"
// JavaMetadata encapsulates all Java ecosystem metadata for a package as well as an (optional) parent relationship.
type JavaMetadata struct {
VirtualPath string `json:"virtual-path"`
VirtualPath string `json:"virtualPath"`
Manifest *JavaManifest `mapstructure:"Manifest" json:"manifest"`
PomProperties *PomProperties `mapstructure:"PomProperties" json:"pomProperties"`
Parent *Package `json:"parentPackage"` // TODO: should this be included in the json output?