Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added property support to license along with unit tests #177

Merged
merged 3 commits into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions schema/bom-1.5.proto
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,8 @@ message License {
optional string bom_ref = 5;
// Licensing details describing the licensor/licensee, license type, renewal and expiration dates, and other important metadata
optional Licensing licensing = 6;
// Specifies optional, custom, properties
repeated Property properties = 7;
}

message Licensing {
Expand Down
7 changes: 7 additions & 0 deletions schema/bom-1.5.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,13 @@
"description": "The timestamp indicating when the current license expires (if applicable)."
}
}
},
"properties": {
"type": "array",
"title": "Properties",
"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.",
"additionalItems": false,
"items": {"$ref": "#/definitions/property"}
}
}
},
Expand Down
26 changes: 18 additions & 8 deletions schema/bom-1.5.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ limitations under the License.
<xs:element name="licenses" type="bom:licenseChoiceType" minOccurs="0" maxOccurs="1"/>
<xs:element name="properties" type="bom:propertiesType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Provides the ability to document properties in a key/value store.
<xs:documentation>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. Property names
of interest to the general public are encouraged to be registered in the
Expand Down Expand Up @@ -358,7 +358,7 @@ limitations under the License.
</xs:element>
<xs:element name="properties" type="bom:propertiesType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Provides the ability to document properties in a key/value store.
<xs:documentation>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. Property names
of interest to the general public are encouraged to be registered in the
Expand Down Expand Up @@ -588,6 +588,16 @@ limitations under the License.
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="properties" type="bom:propertiesType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>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. 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.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded">
<xs:annotation>
<xs:documentation>
Expand Down Expand Up @@ -1046,8 +1056,8 @@ limitations under the License.
are URIs and therefore can accept any URL scheme including https, mailto, tel, and dns.
External references may also include formally registered URNs such as CycloneDX BOM-Link to
reference CycloneDX BOMs or any object within a BOM. BOM-Link transforms applicable external
references into relationships that can be expressed in a BOM or across BOMs. Refer to:</xs:documentation>
https://cyclonedx.org/capabilities/bomlink/
references into relationships that can be expressed in a BOM or across BOMs. Refer to:
https://cyclonedx.org/capabilities/bomlink/</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="comment" type="xs:string" minOccurs="0" maxOccurs="1">
Expand Down Expand Up @@ -1548,7 +1558,7 @@ limitations under the License.
</xs:element>
<xs:element name="properties" type="bom:propertiesType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Provides the ability to document properties in a key/value store.
<xs:documentation>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. Property names
of interest to the general public are encouraged to be registered in the
Expand Down Expand Up @@ -1900,7 +1910,7 @@ limitations under the License.
</xs:element>
<xs:element name="properties" type="bom:propertiesType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Provides the ability to document properties in a key/value store.
<xs:documentation>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. Property names
of interest to the general public are encouraged to be registered in the
Expand Down Expand Up @@ -2271,7 +2281,7 @@ limitations under the License.
</xs:element>
<xs:element name="properties" type="bom:propertiesType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Provides the ability to document properties in a key/value store.
<xs:documentation>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. Property names
of interest to the general public are encouraged to be registered in the
Expand Down Expand Up @@ -2621,7 +2631,7 @@ limitations under the License.
</xs:element>
<xs:element name="properties" type="bom:propertiesType" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>Provides the ability to document properties in a key/value store.
<xs:documentation>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. Property names
of interest to the general public are encouraged to be registered in the
Expand Down
25 changes: 25 additions & 0 deletions tools/src/test/resources/1.5/valid-properties-1.5.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,31 @@
"type": "library",
"name": "acme-library",
"version": "1.0.0",
"licenses": [
{
"license": {
"id": "Apache-2.0",
"properties": [
{
"name": "Foo",
"value": "Bar"
},
{
"name": "Foo",
"value": "You"
},
{
"name": "Foo",
"value": "Two"
},
{
"name": "Bar",
"value": "Foo"
}
]
}
}
],
"properties": [
{
"name": "Foo",
Expand Down
21 changes: 21 additions & 0 deletions tools/src/test/resources/1.5/valid-properties-1.5.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ components {
type: CLASSIFICATION_LIBRARY
name: "acme-library"
version: "1.0.0"
licenses {
license {
id: "Apache-2.0"
properties {
name: "Foo"
value: "Bar"
}
properties {
name: "Foo"
value: "You"
}
properties {
name: "Foo"
value: "Two"
}
properties {
name: "Bar"
value: "Foo"
}
}
}
properties {
name: "Foo"
value: "Bar"
Expand Down
11 changes: 11 additions & 0 deletions tools/src/test/resources/1.5/valid-properties-1.5.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,17 @@
<component type="library">
<name>acme-library</name>
<version>1.0.0</version>
<licenses>
<license>
<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>
</properties>
</license>
</licenses>
<properties>
<property name="Foo">Bar</property>
<property name="Bar">Foo</property>
Expand Down