Skip to content

Commit

Permalink
feat(spec1-5): add current v1.5 schemas
Browse files Browse the repository at this point in the history
Signed-off-by: nscuro <nscuro@protonmail.com>
  • Loading branch information
nscuro committed Jun 18, 2023
1 parent 60695ea commit 78f9a6e
Show file tree
Hide file tree
Showing 7 changed files with 9,544 additions and 2 deletions.
4 changes: 2 additions & 2 deletions encode_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func TestJsonBOMEncoder_EncodeVersion(t *testing.T) {
require.ErrorContains(t, err, "not supported")
})

for _, version := range []SpecVersion{SpecVersion1_2, SpecVersion1_3, SpecVersion1_4} {
for _, version := range []SpecVersion{SpecVersion1_2, SpecVersion1_3, SpecVersion1_4, SpecVersion1_5} {
t.Run(version.String(), func(t *testing.T) {
// Read original BOM JSON
inputFile, err := os.Open("./testdata/valid-bom.json")
Expand Down Expand Up @@ -216,7 +216,7 @@ func TestJsonBOMEncoder_EncodeVersion(t *testing.T) {
}

func TestXmlBOMEncoder_EncodeVersion(t *testing.T) {
for _, version := range []SpecVersion{SpecVersion1_0, SpecVersion1_1, SpecVersion1_2, SpecVersion1_3, SpecVersion1_4} {
for _, version := range []SpecVersion{SpecVersion1_0, SpecVersion1_1, SpecVersion1_2, SpecVersion1_3, SpecVersion1_4, SpecVersion1_5} {
t.Run(version.String(), func(t *testing.T) {
// Read original BOM JSON
inputFile, err := os.Open("./testdata/valid-bom.xml")
Expand Down
3,740 changes: 3,740 additions & 0 deletions schema/bom-1.5.schema.json

Large diffs are not rendered by default.

5,445 changes: 5,445 additions & 0 deletions schema/bom-1.5.xsd

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,176 @@
{
"$schema": "http://cyclonedx.org/schema/bom-1.5.schema.json",
"bomFormat": "CycloneDX",
"specVersion": "1.5",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"metadata": {
"timestamp": "2020-04-13T20:20:39+00:00",
"tools": [
{
"vendor": "Awesome Vendor",
"name": "Awesome Tool",
"version": "9.1.2",
"hashes": [
{
"alg": "SHA-1",
"content": "25ed8e31b995bb927966616df2a42b979a2717f0"
},
{
"alg": "SHA-256",
"content": "a74f733635a19aefb1f73e5947cef59cd7440c6952ef0f03d09d974274cbd6df"
}
]
}
],
"authors": [
{
"name": "Samantha Wright",
"email": "samantha.wright@example.com",
"phone": "800-555-1212"
}
],
"component": {
"type": "application",
"author": "Acme Super Heros",
"name": "Acme Application",
"version": "9.1.1",
"swid": {
"text": {
"content": "PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiID8+CjxTb2Z0d2FyZUlkZW50aXR5IHhtbDpsYW5nPSJFTiIgbmFtZT0iQWNtZSBBcHBsaWNhdGlvbiIgdmVyc2lvbj0iOS4xLjEiIAogdmVyc2lvblNjaGVtZT0ibXVsdGlwYXJ0bnVtZXJpYyIgCiB0YWdJZD0ic3dpZGdlbi1iNTk1MWFjOS00MmMwLWYzODItM2YxZS1iYzdhMmE0NDk3Y2JfOS4xLjEiIAogeG1sbnM9Imh0dHA6Ly9zdGFuZGFyZHMuaXNvLm9yZy9pc28vMTk3NzAvLTIvMjAxNS9zY2hlbWEueHNkIj4gCiB4bWxuczp4c2k9Imh0dHA6Ly93d3cudzMub3JnLzIwMDEvWE1MU2NoZW1hLWluc3RhbmNlIiAKIHhzaTpzY2hlbWFMb2NhdGlvbj0iaHR0cDovL3N0YW5kYXJkcy5pc28ub3JnL2lzby8xOTc3MC8tMi8yMDE1LWN1cnJlbnQvc2NoZW1hLnhzZCBzY2hlbWEueHNkIiA+CiAgPE1ldGEgZ2VuZXJhdG9yPSJTV0lEIFRhZyBPbmxpbmUgR2VuZXJhdG9yIHYwLjEiIC8+IAogIDxFbnRpdHkgbmFtZT0iQWNtZSwgSW5jLiIgcmVnaWQ9ImV4YW1wbGUuY29tIiByb2xlPSJ0YWdDcmVhdG9yIiAvPiAKPC9Tb2Z0d2FyZUlkZW50aXR5Pg==",
"contentType": "text/xml",
"encoding": "base64"
},
"tagId": "swidgen-242eb18a-503e-ca37-393b-cf156ef09691_9.1.1",
"name": "Acme Application",
"version": "9.1.1"
}
},
"manufacture": {
"name": "Acme, Inc.",
"url": [
"https://example.com"
],
"contact": [
{
"name": "Acme Professional Services",
"email": "professional.services@example.com"
}
]
},
"supplier": {
"name": "Acme, Inc.",
"url": [
"https://example.com"
],
"contact": [
{
"name": "Acme Distribution",
"email": "distribution@example.com"
}
]
}
},
"components": [
{
"bom-ref": "pkg:npm/acme/component@1.0.0",
"type": "library",
"publisher": "Acme Inc",
"group": "com.acme",
"name": "tomcat-catalina",
"version": "9.0.14",
"hashes": [
{
"alg": "MD5",
"content": "3942447fac867ae5cdb3229b658f4d48"
},
{
"alg": "SHA-1",
"content": "e6b1000b94e835ffd37f4c6dcbdad43f4b48a02a"
},
{
"alg": "SHA-256",
"content": "f498a8ff2dd007e29c2074f5e4b01a9a01775c3ff3aeaf6906ea503bc5791b7b"
},
{
"alg": "SHA-512",
"content": "e8f33e424f3f4ed6db76a482fde1a5298970e442c531729119e37991884bdffab4f9426b7ee11fccd074eeda0634d71697d6f88a460dce0ac8d627a29f7d1282"
}
],
"licenses": [
{
"license": {
"id": "Apache-2.0",
"text": {
"content": "License text here",
"contentType": "text/plain",
"encoding": "base64"
},
"url": "https://www.apache.org/licenses/LICENSE-2.0.txt"
}
}
],
"purl": "pkg:npm/acme/component@1.0.0",
"pedigree": {
"ancestors": [
{
"type": "library",
"publisher": "Acme Inc",
"group": "com.acme",
"name": "tomcat-catalina",
"version": "9.0.14"
},
{
"type": "library",
"publisher": "Acme Inc",
"group": "com.acme",
"name": "tomcat-catalina",
"version": "9.0.14"
}
],
"commits": [
{
"uid": "123",
"author": {
"timestamp": "2018-11-13T20:20:39+00:00"
}
}
]
}
},
{
"type": "library",
"supplier": {
"name": "Example, Inc.",
"url": [
"https://example.com",
"https://example.net"
],
"contact": [
{
"name": "Example Support AMER Distribution",
"email": "support@example.com",
"phone": "800-555-1212"
},
{
"name": "Example Support APAC",
"email": "support@apac.example.com"
}
]
},
"author": "Example Super Heros",
"group": "org.example",
"name": "mylibrary",
"version": "1.0.0"
}
],
"dependencies": [
{
"ref": "pkg:npm/acme/component@1.0.0",
"dependsOn": [
"pkg:npm/acme/component@1.0.0"
]
}
]
}

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions validate_json_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var jsonSchemaFiles = map[SpecVersion]string{
SpecVersion1_2: "file://./schema/bom-1.2.schema.json",
SpecVersion1_3: "file://./schema/bom-1.3.schema.json",
SpecVersion1_4: "file://./schema/bom-1.4.schema.json",
SpecVersion1_5: "file://./schema/bom-1.5.schema.json",
}

type jsonValidator struct {
Expand Down
1 change: 1 addition & 0 deletions validate_xml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var xmlSchemaFiles = map[SpecVersion]string{
SpecVersion1_2: "./schema/bom-1.2.xsd",
SpecVersion1_3: "./schema/bom-1.3.xsd",
SpecVersion1_4: "./schema/bom-1.4.xsd",
SpecVersion1_5: "./schema/bom-1.5.xsd",
}

var xsdValidateInitOnce sync.Once
Expand Down

0 comments on commit 78f9a6e

Please sign in to comment.