From 647753b81ef5d2d7ebab1e7dff9614516ced0d94 Mon Sep 17 00:00:00 2001 From: Jan Kowalleck Date: Mon, 6 May 2024 13:58:12 +0200 Subject: [PATCH] fix Signed-off-by: Jan Kowalleck --- .../schema/_res/bom-1.2-strict.SNAPSHOT.schema.json | 5 +---- .../schema/_res/bom-1.3-strict.SNAPSHOT.schema.json | 5 +---- cyclonedx/schema/_res/bom-1.4.SNAPSHOT.schema.json | 5 +---- cyclonedx/schema/_res/bom-1.5.SNAPSHOT.schema.json | 5 +---- tools/schema-downloader.py | 11 ++++++----- 5 files changed, 10 insertions(+), 21 deletions(-) diff --git a/cyclonedx/schema/_res/bom-1.2-strict.SNAPSHOT.schema.json b/cyclonedx/schema/_res/bom-1.2-strict.SNAPSHOT.schema.json index 682cf739..a36fb4b6 100644 --- a/cyclonedx/schema/_res/bom-1.2-strict.SNAPSHOT.schema.json +++ b/cyclonedx/schema/_res/bom-1.2-strict.SNAPSHOT.schema.json @@ -11,10 +11,7 @@ "additionalProperties": false, "properties": { "$schema": { - "type": "string", - "enum": [ - "http://cyclonedx.org/schema/bom-1.2b.schema.json" - ] + "type": "string" }, "bomFormat": { "$id": "#/properties/bomFormat", diff --git a/cyclonedx/schema/_res/bom-1.3-strict.SNAPSHOT.schema.json b/cyclonedx/schema/_res/bom-1.3-strict.SNAPSHOT.schema.json index a1142620..3f1b82d9 100644 --- a/cyclonedx/schema/_res/bom-1.3-strict.SNAPSHOT.schema.json +++ b/cyclonedx/schema/_res/bom-1.3-strict.SNAPSHOT.schema.json @@ -11,10 +11,7 @@ "additionalProperties": false, "properties": { "$schema": { - "type": "string", - "enum": [ - "http://cyclonedx.org/schema/bom-1.3a.schema.json" - ] + "type": "string" }, "bomFormat": { "$id": "#/properties/bomFormat", diff --git a/cyclonedx/schema/_res/bom-1.4.SNAPSHOT.schema.json b/cyclonedx/schema/_res/bom-1.4.SNAPSHOT.schema.json index 1a885810..48a462e3 100644 --- a/cyclonedx/schema/_res/bom-1.4.SNAPSHOT.schema.json +++ b/cyclonedx/schema/_res/bom-1.4.SNAPSHOT.schema.json @@ -11,10 +11,7 @@ "additionalProperties": false, "properties": { "$schema": { - "type": "string", - "enum": [ - "http://cyclonedx.org/schema/bom-1.4.schema.json" - ] + "type": "string" }, "bomFormat": { "type": "string", diff --git a/cyclonedx/schema/_res/bom-1.5.SNAPSHOT.schema.json b/cyclonedx/schema/_res/bom-1.5.SNAPSHOT.schema.json index 7edeab0f..72781e90 100644 --- a/cyclonedx/schema/_res/bom-1.5.SNAPSHOT.schema.json +++ b/cyclonedx/schema/_res/bom-1.5.SNAPSHOT.schema.json @@ -11,10 +11,7 @@ "additionalProperties": false, "properties": { "$schema": { - "type": "string", - "enum": [ - "http://cyclonedx.org/schema/bom-1.5.schema.json" - ] + "type": "string" }, "bomFormat": { "type": "string", diff --git a/tools/schema-downloader.py b/tools/schema-downloader.py index 3ef556d0..99def578 100644 --- a/tools/schema-downloader.py +++ b/tools/schema-downloader.py @@ -29,13 +29,14 @@ ] } -# "version" is not required but optional with a default value! -# this is wrong in schema<1.5 +# "$schema" is not required but optional. +# that enum constraint value there is complicated -> remove it. +# See https://github.com/CycloneDX/specification/issues/402 +# See https://github.com/CycloneDX/specification/pull/403 _BOM_SCHEMA_ENUM_RE = re.compile( - r'("\$id": "(http://cyclonedx\.org/schema/bom.+?\.schema\.json)".*"enum": \[\s+")' - r'http://cyclonedx\.org/schema/bom.+?\.schema\.json"', + r',?\s*"enum":\s*\[\s*"http://cyclonedx\.org/schema/.+?\.schema\.json"\s*\]', re.DOTALL) -_BOM_SCHEMA_ENUM_REPL = r'\1\2"' +_BOM_SCHEMA_ENUM_REPL = r'' # "version" is not required but optional with a default value!