Skip to content

Commit

Permalink
Added valid standard JSON and XML test cases and minor corrections to…
Browse files Browse the repository at this point in the history
… schemas.

Signed-off-by: Steve Springett <[email protected]>
  • Loading branch information
stevespringett committed Dec 21, 2023
1 parent 7b6c563 commit 5be18a1
Show file tree
Hide file tree
Showing 3 changed files with 130 additions and 51 deletions.
10 changes: 5 additions & 5 deletions schema/bom-1.6.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4231,16 +4231,16 @@
"title": "Name",
"description": "The name of the standard. This will often be a shortened, single name of the standard."
},
"description": {
"type": "string",
"title": "Description",
"description": "The description of the standard."
},
"version": {
"type": "string",
"title": "Version",
"description": "The version of the standard."
},
"description": {
"type": "string",
"title": "Description",
"description": "The description of the standard."
},
"owner": {
"type": "string",
"title": "Owner",
Expand Down
98 changes: 52 additions & 46 deletions schema/bom-1.6.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -6042,17 +6042,17 @@ limitations under the License.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="description" type="xs:string">
<xs:element name="version" type="xs:string">
<xs:annotation>
<xs:documentation>
The description of the standard.
The version of the standard.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="version" type="xs:string">
<xs:element name="description" type="xs:string">
<xs:annotation>
<xs:documentation>
The version of the standard.
The description of the standard.
</xs:documentation>
</xs:annotation>
</xs:element>
Expand Down Expand Up @@ -6170,54 +6170,60 @@ limitations under the License.
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="identifier" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
The identifier used in the standard to identify a specific level.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
The title of the level.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
The description of the level.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="requirements" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
The list of requirement `bom-ref`s that comprise the level.
</xs:documentation>
</xs:annotation>
<xs:element name="level" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="requirement" type="bom:refLinkType" minOccurs="0" maxOccurs="unbounded"/>
<xs:element name="identifier" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
The identifier used in the standard to identify a specific level.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="title" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
The title of the level.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="description" type="xs:string" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
The description of the level.
</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="requirements" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>
The list of requirement `bom-ref`s that comprise the level.
</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="requirement" type="bom:refLinkType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="bom-ref" type="bom:refType">
<xs:annotation>
<xs:documentation>
An optional identifier which can be used to reference the object elsewhere
in the BOM. Every bom-ref MUST be unique within the BOM.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:anyAttribute namespace="##other" processContents="lax">
<xs:annotation>
<xs:documentation>User-defined attributes may be used on this element as long as they
do not have the same name as an existing attribute used by the schema.</xs:documentation>
</xs:annotation>
</xs:anyAttribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="bom-ref" type="bom:refType">
<xs:annotation>
<xs:documentation>
An optional identifier which can be used to reference the object elsewhere
in the BOM. Every bom-ref MUST be unique within the BOM.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:anyAttribute namespace="##other" processContents="lax">
<xs:annotation>
<xs:documentation>User-defined attributes may be used on this element as long as they
do not have the same name as an existing attribute used by the schema.</xs:documentation>
</xs:annotation>
</xs:anyAttribute>
</xs:complexType>
</xs:element>
<xs:element name="externalReferences" type="bom:externalReferences" minOccurs="0" maxOccurs="1">
Expand Down
73 changes: 73 additions & 0 deletions tools/src/test/resources/1.6/valid-standard-1.6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"definitions": {
"standards": [
{
"bom-ref": "standard-1",
"name": "Sample Standard",
"version": "1.0.0",
"description": "Description here",
"owner": "Acme Inc",
"requirements": [
{
"bom-ref": "requirement-1",
"identifier": "v1",
"title": "Title here"
},
{
"bom-ref": "requirement-1.1",
"identifier": "v1.1",
"title": "Title here",
"parent": "requirement-1"
},
{
"bom-ref": "requirement-1.1.1",
"identifier": "v1.1.1",
"text": "Text of the requirement here",
"descriptions": [
"Supplemental text here"
],
"opencre": [
"CRE:616-305"
],
"parent": "requirement-1.1"
}
],
"levels": [
{
"bom-ref": "level-1",
"identifier": "Level 1",
"description": "Description here",
"requirements": [
"requirement-1.1.1"
]
},
{
"bom-ref": "level-2",
"identifier": "Level 2",
"description": "Description here",
"requirements": [
"requirement-1.1.1"
]
},
{
"bom-ref": "level-3",
"identifier": "Level 3",
"description": "Description here",
"requirements": [
"requirement-1.1.1"
]
}
],
"signature": {
"algorithm": "ES256",
"certificatePath": [ "MIIB...", "MIID..." ],
"value": "tqIT..."
}
}
]
}
}

0 comments on commit 5be18a1

Please sign in to comment.