Skip to content

Commit 40e71cd

Browse files
committed
draft: JSON - extraneous comp and version range
related to CycloneDX#321 CycloneDX#321 Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent 335dfab commit 40e71cd

7 files changed

+110
-1
lines changed

schema/bom-1.6.schema.json

+22-1
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,10 @@
461461
"title": "Component Version",
462462
"description": "The component version. The version should ideally comply with semantic versioning but is not enforced."
463463
},
464+
"versionRange": {
465+
"$ref": "#/definitions/versionRange",
466+
"title": "Component Version Range"
467+
},
464468
"description": {
465469
"type": "string",
466470
"title": "Component Description",
@@ -477,6 +481,12 @@
477481
"description": "Specifies the scope of the component. If scope is not specified, 'required' scope SHOULD be assumed by the consumer of the BOM.",
478482
"default": "required"
479483
},
484+
"isExtraneous": {
485+
"type": "boolean",
486+
"title": "Component Is Extraneous",
487+
"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`.",
488+
"default": false
489+
},
480490
"hashes": {
481491
"type": "array",
482492
"title": "Component Hashes",
@@ -601,7 +611,18 @@
601611
"title": "Signature",
602612
"description": "Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html)."
603613
}
604-
}
614+
},
615+
"allOf": [
616+
{
617+
"$comment": "property `version` and `versionRange` MUST NOT exist at the same time.",
618+
"not": { "required": ["version", "versionRange"] }
619+
},
620+
{
621+
"$comment": "`version-range` MUST only be present, if `isExtraneous` is `true`",
622+
"if": { "properties": { "isExtraneous": { "const": false } } },
623+
"then": { "not": { "required": ["versionRange"] } }
624+
}
625+
]
605626
},
606627
"swid": {
607628
"type": "object",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"bomFormat": "CycloneDX",
3+
"specVersion": "1.6",
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.6",
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.6",
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.6",
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.6",
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.6",
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)