Skip to content

Commit

Permalink
schema spec1.4: own type for ref/bom-ref
Browse files Browse the repository at this point in the history
part of  #114

Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
  • Loading branch information
jkowalleck committed Dec 28, 2021
1 parent ab88610 commit b7d53b4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
16 changes: 10 additions & 6 deletions schema/bom-1.4-SNAPSHOT.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@
}
},
"definitions": {
"refType": {
"$comment": "Identifier-DataType for interlinked elements.",
"type": "string"
},
"metadata": {
"type": "object",
"title": "BOM Metadata Object",
Expand Down Expand Up @@ -285,7 +289,7 @@
"pattern": "^[-+a-z0-9.]+/[-+a-z0-9.]+$"
},
"bom-ref": {
"type": "string",
"$ref": "#/definitions/refType",
"title": "BOM Reference",
"description": "An optional identifier which can be used to reference the component elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
},
Expand Down Expand Up @@ -882,15 +886,15 @@
"additionalProperties": false,
"properties": {
"ref": {
"type": "string",
"$ref": "#/definitions/refType",
"title": "Reference",
"description": "References a component by the components bom-ref attribute"
},
"dependsOn": {
"type": "array",
"uniqueItems": true,
"items": {
"type": "string"
"$ref": "#/definitions/refType"
},
"title": "Depends On",
"description": "The bom-ref identifiers of the components that are dependencies of this dependency object."
Expand All @@ -906,7 +910,7 @@
"additionalProperties": false,
"properties": {
"bom-ref": {
"type": "string",
"$ref": "#/definitions/refType",
"title": "BOM Reference",
"description": "An optional identifier which can be used to reference the service elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
},
Expand Down Expand Up @@ -1391,7 +1395,7 @@
"additionalProperties": false,
"properties": {
"bom-ref": {
"type": "string",
"$ref": "#/definitions/refType",
"title": "BOM Reference",
"description": "An optional identifier which can be used to reference the vulnerability elsewhere in the BOM. Every bom-ref MUST be unique within the BOM."
},
Expand Down Expand Up @@ -1573,7 +1577,7 @@
"additionalProperties": false,
"properties": {
"ref": {
"type": "string",
"$ref": "#/definitions/refType",
"title": "Reference",
"description": "References a component or service by the objects bom-ref"
},
Expand Down
17 changes: 12 additions & 5 deletions schema/bom-1.4-SNAPSHOT.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ limitations under the License.
</xs:documentation>
</xs:annotation>

<xs:simpleType name="refType" id="refType">
<xs:annotation>
<xs:documentation>Identifier-DataType for interlinked elements.</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string" />
</xs:simpleType>

<xs:complexType name="metadata">
<xs:sequence minOccurs="0" maxOccurs="1">
<xs:element name="timestamp" type="xs:dateTime" minOccurs="0">
Expand Down Expand Up @@ -415,7 +422,7 @@ limitations under the License.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="bom-ref" type="xs:string">
<xs:attribute name="bom-ref" type="bom:refType">
<xs:annotation>
<xs:documentation>
An optional identifier which can be used to reference the component elsewhere in the BOM.
Expand Down Expand Up @@ -1176,7 +1183,7 @@ limitations under the License.
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="dependency" type="bom:dependencyType"/>
</xs:sequence>
<xs:attribute name="ref" type="xs:string" use="required">
<xs:attribute name="ref" type="bom:refType" use="required">
<xs:annotation>
<xs:documentation>References a component or service by the its bom-ref attribute</xs:documentation>
</xs:annotation>
Expand Down Expand Up @@ -1337,7 +1344,7 @@ limitations under the License.
</xs:annotation>
</xs:any>
</xs:sequence>
<xs:attribute name="bom-ref" type="xs:string">
<xs:attribute name="bom-ref" type="bom:refType">
<xs:annotation>
<xs:documentation>
An optional identifier which can be used to reference the service elsewhere in the BOM.
Expand Down Expand Up @@ -1673,7 +1680,7 @@ limitations under the License.
</xs:complexType>

<xs:complexType name="bomReferenceType">
<xs:attribute name="ref" type="xs:string" use="required">
<xs:attribute name="ref" type="bom:refType" use="required">
<xs:annotation>
<xs:documentation>References a component or service by the its bom-ref attribute</xs:documentation>
</xs:annotation>
Expand Down Expand Up @@ -2004,7 +2011,7 @@ limitations under the License.
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="bom-ref" type="xs:string">
<xs:attribute name="bom-ref" type="bom:refType">
<xs:annotation>
<xs:documentation>
An optional identifier which can be used to reference the vulnerability elsewhere in the BOM.
Expand Down

0 comments on commit b7d53b4

Please sign in to comment.