Skip to content

Commit 4aef005

Browse files
committed
draft: JSON - extraneous comp and version range
related to #321 #321 Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 20d766d commit 4aef005

7 files changed

+110
-1
lines changed

schema/bom-1.7.schema.json

+22-1
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,10 @@
925925
"title": "Component Version",
926926
"description": "The component version. The version should ideally comply with semantic versioning but is not enforced."
927927
},
928+
"versionRange": {
929+
"$ref": "#/definitions/versionRange",
930+
"title": "Component Version Range"
931+
},
928932
"description": {
929933
"type": "string",
930934
"title": "Component Description",
@@ -946,6 +950,12 @@
946950
"description": "Specifies the scope of the component. If scope is not specified, 'required' scope SHOULD be assumed by the consumer of the BOM.",
947951
"default": "required"
948952
},
953+
"isExtraneous": {
954+
"type": "boolean",
955+
"title": "Component Is Extraneous",
956+
"description": "Whether this component is extraneous.\nAn extraneous component is not part of an assembly, but are (expected to be) provided by the environment, regardless of the component's `scope`.",
957+
"default": false
958+
},
949959
"hashes": {
950960
"type": "array",
951961
"title": "Component Hashes",
@@ -1096,7 +1106,18 @@
10961106
"title": "Signature",
10971107
"description": "Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html)."
10981108
}
1099-
}
1109+
},
1110+
"allOf": [
1111+
{
1112+
"$comment": "property `version` and `versionRange` MUST NOT exist at the same time.",
1113+
"not": { "required": ["version", "versionRange"] }
1114+
},
1115+
{
1116+
"$comment": "`version-range` MUST only be present, if `isExtraneous` is `true`",
1117+
"if": { "properties": { "isExtraneous": { "const": false } } },
1118+
"then": { "not": { "required": ["versionRange"] } }
1119+
}
1120+
]
11001121
},
11011122
"swid": {
11021123
"type": "object",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.7",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "InvalidVersions",
10+
"description": "may have `version` or `versionRange`, not both. This one does - it is invalid",
11+
"version": "9.0.14",
12+
"versionRange": ">=9.0.0|<10.0.0"
13+
}
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.7",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "InvalidVersions",
10+
"description": "versionRange may only exist on extraneous components, set `isExtraneous` explicit",
11+
"isExtraneous": false,
12+
"versionRange": ">=9.0.0|<10.0.0"
13+
}
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.7",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "InvalidVersions",
10+
"description": "versionRange may only exist on extraneous components, set `isExtraneous` implicit by default value",
11+
"versionRange": ">=9.0.0|<10.0.0"
12+
}
13+
]
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.7",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "Foo",
10+
"description": "extraneous without any version constraints",
11+
"isExtraneous": true
12+
}
13+
]
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.7",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "Foo",
10+
"description": "extraneous with version constraint",
11+
"isExtraneous": true,
12+
"version": "9.1.24"
13+
}
14+
]
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.7",
4+
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
5+
"version": 1,
6+
"components": [
7+
{
8+
"type": "library",
9+
"name": "Foo",
10+
"description": "extraneous with version range constraints",
11+
"isExtraneous": true,
12+
"versionRange": ">=9.0.0|<10.0.0"
13+
}
14+
]
15+
}

0 commit comments

Comments
 (0)