Skip to content

Commit

Permalink
draft: JSON - extraneous comp and version range
Browse files Browse the repository at this point in the history
related to CycloneDX#321 CycloneDX#321

Signed-off-by: Jan Kowalleck <[email protected]>
  • Loading branch information
jkowalleck committed Oct 22, 2023
1 parent 6dac012 commit 68f3340
Show file tree
Hide file tree
Showing 7 changed files with 110 additions and 1 deletion.
23 changes: 22 additions & 1 deletion schema/bom-1.6.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,10 @@
"title": "Component Version",
"description": "The component version. The version should ideally comply with semantic versioning but is not enforced."
},
"versionRange": {
"$ref": "#/definitions/versionRange",
"title": "Component Version Range"
},
"description": {
"type": "string",
"title": "Component Description",
Expand All @@ -477,6 +481,12 @@
"description": "Specifies the scope of the component. If scope is not specified, 'required' scope SHOULD be assumed by the consumer of the BOM.",
"default": "required"
},
"isExtraneous": {
"type": "boolean",
"title": "Component Is Extraneous",
"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`.",
"default": false
},
"hashes": {
"type": "array",
"title": "Component Hashes",
Expand Down Expand Up @@ -601,7 +611,18 @@
"title": "Signature",
"description": "Enveloped signature in [JSON Signature Format (JSF)](https://cyberphone.github.io/doc/security/jsf.html)."
}
}
},
"allOf": [
{
"$comment": "property `version` and `versionRange` MUST NOT exist at the same time.",
"not": { "required": ["version", "versionRange"] }
},
{
"$comment": "`version-range` MUST only be present, if `isExtraneous` is `true`",
"if": { "properties": { "isExtraneous": { "const": false } } },
"then": { "not": { "required": ["versionRange"] } }
}
]
},
"swid": {
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"name": "InvalidVersions",
"description": "may have `version` or `versionRange`, not both. This one does - it is invalid",
"version": "9.0.14",
"versionRange": ">=9.0.0|<10.0.0"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"name": "InvalidVersions",
"description": "versionRange may only exist on extraneous components, set `isExtraneous` explicit",
"isExtraneous": false,
"versionRange": ">=9.0.0|<10.0.0"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"name": "InvalidVersions",
"description": "versionRange may only exist on extraneous components, set `isExtraneous` implicit by default value",
"versionRange": ">=9.0.0|<10.0.0"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"name": "Foo",
"description": "extraneous without any version constraints",
"isExtraneous": true
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"name": "Foo",
"description": "extraneous with version constraint",
"isExtraneous": true,
"version": "9.1.24"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"bomFormat": "CycloneDX",
"specVersion": "1.6",
"serialNumber": "urn:uuid:3e671687-395b-41f5-a30f-a58921a69b79",
"version": 1,
"components": [
{
"type": "library",
"name": "Foo",
"description": "extraneous with version range constraints",
"isExtraneous": true,
"versionRange": ">=9.0.0|<10.0.0"
}
]
}

0 comments on commit 68f3340

Please sign in to comment.