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

Introduce type for BOM-Link #235

Merged
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
20 changes: 20 additions & 0 deletions schema/bom-1.5.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,26 @@
"$comment": "Identifier-DataType for interlinked elements.",
"type": "string"
},
"bomLinkDocumentType": {
"title": "BOM-Link document",
"description": "Descriptor for another BOM document. See https://cyclonedx.org/capabilities/bomlink/",
"type": "string",
"pattern": "^urn:cdx:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/[1-9][0-9]*$",
"$comment": "part of the pattern is based on `bom.serialNumber`'s pattern"
},
"bomLinkElementType": {
"title": "BOM-Link element",
"description": "Descriptor for an element in another BOM document. See https://cyclonedx.org/capabilities/bomlink/",
"type": "string",
"pattern": "^urn:cdx:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/[1-9][0-9]*#.+$",
"$comment": "part of the pattern is based on `bom.serialNumber`'s pattern"
},
"bomLink": {
"anyOf": [
{"$ref": "#/definitions/bomLinkDocumentType"},
{"$ref": "#/definitions/bomLinkElementType"}
]
},
"metadata": {
"type": "object",
"title": "BOM Metadata Object",
Expand Down
28 changes: 28 additions & 0 deletions schema/bom-1.5.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,34 @@ limitations under the License.
<xs:restriction base="xs:string" />
</xs:simpleType>

<xs:simpleType name="bomLinkDocumentType">
<xs:annotation>
<xs:documentation xml:lang="en">
Descriptor for another BOM document.
See https://cyclonedx.org/capabilities/bomlink/
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<!-- part of the pattern is based on `bom.serialNumber`'s pattern -->
<xs:pattern value="urn:cdx:([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})|(\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\})/[1-9][0-9]*"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="bomLinkElementType">
<xs:annotation>
<xs:documentation xml:lang="en">
Descriptor for an element in another BOM document.
See https://cyclonedx.org/capabilities/bomlink/
</xs:documentation>
</xs:annotation>
<xs:restriction base="xs:string">
<!-- part of the pattern is based on `bom.serialNumber`'s pattern -->
<xs:pattern value="urn:cdx:([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})|(\{[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\})/[1-9][0-9]*#.+"/>
</xs:restriction>
</xs:simpleType>
<xs:simpleType name="bomLinkType">
<xs:union memberTypes="bom:bomLinkDocumentType bom:bomLinkElementType"/>
</xs:simpleType>

<xs:complexType name="metadata">
<xs:sequence minOccurs="0" maxOccurs="1">
<xs:element name="timestamp" type="xs:dateTime" minOccurs="0">
Expand Down