Skip to content

Commit

Permalink
schema: 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 <[email protected]>
  • Loading branch information
jkowalleck committed Dec 28, 2021
1 parent efe5b9d commit 4d2b8df
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 25 deletions.
9 changes: 8 additions & 1 deletion schema/bom-1.1.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ limitations under the License.
</xs:documentation>
</xs:annotation>

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

<xs:complexType name="componentsType">
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="component" type="bom:component"/>
Expand Down Expand Up @@ -201,7 +208,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
13 changes: 8 additions & 5 deletions schema/bom-1.2-strict.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
}
},
"definitions": {
"refType": {
"$comment": "Identifier-DataType for interlinked elements.",
"type": "string"
},
"metadata": {
"type": "object",
"title": "BOM Metadata Object",
Expand Down Expand Up @@ -261,7 +265,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 should be unique.",
"default": "",
Expand Down Expand Up @@ -859,16 +863,15 @@
"additionalProperties": false,
"properties": {
"ref": {
"type": "string",
"format": "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 @@ -884,7 +887,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 should be unique.",
"default": "",
Expand Down
12 changes: 8 additions & 4 deletions schema/bom-1.2.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,10 @@
}
},
"definitions": {
"refType": {
"$comment": "Identifier-DataType for interlinked elements.",
"type": "string"
},
"metadata": {
"type": "object",
"title": "BOM Metadata Object",
Expand Down Expand Up @@ -249,7 +253,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 should be unique.",
"default": "",
Expand Down Expand Up @@ -833,7 +837,7 @@
],
"properties": {
"ref": {
"type": "string",
"$ref": "#/definitions/refType",
"format": "string",
"title": "Reference",
"description": "References a component by the components bom-ref attribute"
Expand All @@ -842,7 +846,7 @@
"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 @@ -857,7 +861,7 @@
],
"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 should be unique.",
"default": "",
Expand Down
13 changes: 10 additions & 3 deletions schema/bom-1.2.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ limitations under the License.
</xs:documentation>
</xs:annotation>

<xs:simpleType name="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 @@ -395,7 +402,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 @@ -1144,7 +1151,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 @@ -1302,7 +1309,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
12 changes: 8 additions & 4 deletions schema/bom-1.3-strict.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
}
},
"definitions": {
"refType": {
"$comment": "Identifier-DataType for interlinked elements.",
"type": "string"
},
"metadata": {
"type": "object",
"title": "BOM Metadata Object",
Expand Down Expand Up @@ -267,7 +271,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 should be unique."
},
Expand Down Expand Up @@ -852,15 +856,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 @@ -876,7 +880,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 should be unique."
},
Expand Down
12 changes: 8 additions & 4 deletions schema/bom-1.3.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@
}
},
"definitions": {
"refType": {
"$comment": "Identifier-DataType for interlinked elements.",
"type": "string"
},
"metadata": {
"type": "object",
"title": "BOM Metadata Object",
Expand Down Expand Up @@ -255,7 +259,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 should be unique."
},
Expand Down Expand Up @@ -826,15 +830,15 @@
],
"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 @@ -849,7 +853,7 @@
],
"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 should be unique."
},
Expand Down
15 changes: 11 additions & 4 deletions schema/bom-1.3.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">
<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 @@ -400,7 +407,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 @@ -1156,7 +1163,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 @@ -1309,7 +1316,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 @@ -1502,7 +1509,7 @@ limitations under the License.
</xs:simpleType>

<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

0 comments on commit 4d2b8df

Please sign in to comment.