Skip to content

Commit

Permalink
1.6 dev fix properties json - fixes #371 (#375)
Browse files Browse the repository at this point in the history
fixes #371 

- [x] fixed JSON
- [x] added examples and tests
  • Loading branch information
stevespringett authored Feb 9, 2024
2 parents 46ff114 + 0981967 commit 6686375
Show file tree
Hide file tree
Showing 7 changed files with 221 additions and 19 deletions.
6 changes: 5 additions & 1 deletion schema/bom-1.6.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2218,6 +2218,9 @@
"type": "object",
"title": "Lightweight name-value pair",
"description": "Provides the ability to document properties in a name-value store. This provides flexibility to include data not officially supported in the standard without having to use additional namespaces or create extensions. Unlike key-value stores, properties support duplicate names, each potentially having different values. Property names of interest to the general public are encouraged to be registered in the [CycloneDX Property Taxonomy](https://github.com/CycloneDX/cyclonedx-property-taxonomy). Formal registration is OPTIONAL.",
"required": [
"name"
],
"properties": {
"name": {
"type": "string",
Expand All @@ -2229,7 +2232,8 @@
"title": "Value",
"description": "The value of the property."
}
}
},
"additionalProperties": false
},
"localeType": {
"type": "string",
Expand Down
68 changes: 68 additions & 0 deletions tools/src/test/resources/1.6/invalid-properties-1.6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:bcb403ae-91fa-436e-bc93-84d1078cdeed",
"version": 1,
"metadata": {
"properties": [
{
"value": "missing a name"
},
{
"unexpected-property": "foo"
},
{}
]
},
"components": [
{
"type": "library",
"name": "acme-library",
"version": "1.0.0",
"licenses": [
{
"license": {
"id": "Apache-2.0",
"properties": [
{
"value": "missing a name"
},
{
"unexpected-property": "foo"
},
{}
]
}
}
],
"properties": [
{
"value": "missing a name"
},
{
"unexpected-property": "foo"
},
{}
]
}
],
"services": [
{
"bom-ref": "b2a46a4b-8367-4bae-9820-95557cfe03a8",
"group": "org.partner",
"name": "Stock ticker service",
"endpoints": [
"https://partner.org/api/v1/stock"
],
"properties": [
{
"value": "missing a name"
},
{
"unexpected-property": "foo"
},
{}
]
}
]
}
45 changes: 45 additions & 0 deletions tools/src/test/resources/1.6/invalid-properties-1.6.textproto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
spec_version: "1.6"
version: 1
serial_number: "urn:uuid:bcb403ae-91fa-436e-bc93-84d1078cdeed"
metadata {
properties {
value: "missing a name"
}
properties {
# no name and no value
}
}
components {
type: CLASSIFICATION_LIBRARY
name: "acme-library"
version: "1.0.0"
licenses {
license {
id: "Apache-2.0"
properties {
value: "missing a name"
}
properties {
# no name and no value
}
}
}
properties {
value: "missing a name"
}
properties {
# no name and no value
}
}
services {
bom_ref: "b2a46a4b-8367-4bae-9820-95557cfe03a8"
group: "org.partner"
name: "Stock ticker service"
endpoints: "https://partner.org/api/v1/stock"
properties {
value: "missing a name"
}
properties {
# no name and no value
}
}
41 changes: 41 additions & 0 deletions tools/src/test/resources/1.6/invalid-properties-1.6.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?xml version="1.0"?>
<bom serialNumber="urn:uuid:bcb403ae-91fa-436e-bc93-84d1078cdeed" version="1" xmlns="http://cyclonedx.org/schema/bom/1.6">
<metadata>
<properties>
<property>missing a name</property>
<property><!-- no name and no value --></property>
</properties>
</metadata>
<components>
<component type="library">
<name>acme-library</name>
<version>1.0.0</version>
<licenses>
<license>
<id>Apache-2.0</id>
<properties>
<property>missing a name</property>
<property><!-- no name and no value --></property>
</properties>
</license>
</licenses>
<properties>
<property>missing a name</property>
<property><!-- no name and no value --></property>
</properties>
</component>
</components>
<services>
<service bom-ref="b2a46a4b-8367-4bae-9820-95557cfe03a8">
<group>org.partner</group>
<name>Stock ticker service</name>
<endpoints>
<endpoint>https://partner.org/api/v1/stock</endpoint>
</endpoints>
<properties>
<property>missing a name</property>
<property><!-- no name and no value --></property>
</properties>
</service>
</services>
</bom>
36 changes: 28 additions & 8 deletions tools/src/test/resources/1.6/valid-properties-1.6.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
"name": "Foo",
"value": "Bar"
},
{
"name": "Foo",
"value": "You"
},
{
"name": "Foo",
"value": "Two"
},
{
"name": "Bar",
"value": "Foo"
},
{
"name": "value-is-optional"
}
]
},
Expand All @@ -37,17 +36,16 @@
"name": "Foo",
"value": "Bar"
},
{
"name": "Foo",
"value": "You"
},
{
"name": "Foo",
"value": "Two"
},
{
"name": "Bar",
"value": "Foo"
},
{
"name": "value-is-optional"
}
]
}
Expand All @@ -57,6 +55,17 @@
{
"name": "Foo",
"value": "Bar"
},
{
"name": "Foo",
"value": "Two"
},
{
"name": "Bar",
"value": "Foo"
},
{
"name": "value-is-optional"
}
]
}
Expand All @@ -73,6 +82,17 @@
{
"name": "Foo",
"value": "Bar"
},
{
"name": "Foo",
"value": "Two"
},
{
"name": "Bar",
"value": "Foo"
},
{
"name": "value-is-optional"
}
]
}
Expand Down
36 changes: 28 additions & 8 deletions tools/src/test/resources/1.6/valid-properties-1.6.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@ metadata {
name: "Foo"
value: "Bar"
}
properties {
name: "Foo"
value: "You"
}
properties {
name: "Foo"
value: "Two"
Expand All @@ -18,6 +14,9 @@ metadata {
name: "Bar"
value: "Foo"
}
properties {
name: "value-is-optional"
}
}
components {
type: CLASSIFICATION_LIBRARY
Expand All @@ -30,10 +29,6 @@ components {
name: "Foo"
value: "Bar"
}
properties {
name: "Foo"
value: "You"
}
properties {
name: "Foo"
value: "Two"
Expand All @@ -42,12 +37,26 @@ components {
name: "Bar"
value: "Foo"
}
properties {
name: "value-is-optional"
}
}
}
properties {
name: "Foo"
value: "Bar"
}
properties {
name: "Foo"
value: "Two"
}
properties {
name: "Bar"
value: "Foo"
}
properties {
name: "value-is-optional"
}
}
services {
bom_ref: "b2a46a4b-8367-4bae-9820-95557cfe03a8"
Expand All @@ -58,4 +67,15 @@ services {
name: "Foo"
value: "Bar"
}
properties {
name: "Foo"
value: "Two"
}
properties {
name: "Bar"
value: "Foo"
}
properties {
name: "value-is-optional"
}
}
8 changes: 6 additions & 2 deletions tools/src/test/resources/1.6/valid-properties-1.6.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<metadata>
<properties>
<property name="Foo">Bar</property>
<property name="Foo">You</property>
<property name="Foo">Two</property>
<property name="Bar">Foo</property>
<property name="value-is-optional"/>
</properties>
</metadata>
<components>
Expand All @@ -17,15 +17,17 @@
<id>Apache-2.0</id>
<properties>
<property name="Foo">Bar</property>
<property name="Foo">You</property>
<property name="Foo">Two</property>
<property name="Bar">Foo</property>
<property name="value-is-optional"/>
</properties>
</license>
</licenses>
<properties>
<property name="Foo">Bar</property>
<property name="Foo">Two</property>
<property name="Bar">Foo</property>
<property name="value-is-optional"/>
</properties>
</component>
</components>
Expand All @@ -38,7 +40,9 @@
</endpoints>
<properties>
<property name="Foo">Bar</property>
<property name="Foo">Two</property>
<property name="Bar">Foo</property>
<property name="value-is-optional"/>
</properties>
</service>
</services>
Expand Down

0 comments on commit 6686375

Please sign in to comment.