From 4c31d23af11513d77218bf587940ddf6a013b483 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E7=9A=87=E8=80=85=E5=8D=8E?=
<328654030+BLDT-36@users.noreply.github.com>
Date: Mon, 30 Nov 2026 14:15:02 +0800
Subject: [PATCH] fix: correct misspelled `ExternalReferenceType.RFC_9166` to
`RFC_9116`
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
`ExternalReferenceType` declared the CycloneDX 1.6+ `rfc-9116` external
reference type with transposed digits, so `ExternalReferenceType.RFC_9116`
did not exist and `ExternalReferenceType('rfc-9116').name` reported the
typo `'RFC_9166'`.
The member is now spelled `RFC_9116`, matching the schema value and the
`UPPER_SNAKE_CASE` naming of the other members. `RFC_9166` is kept as an
alias, so existing attribute access keeps working - only the reported
`.name` changes, which is the compatibility remark from the issue.
The schema-1.6 registration and the enum snapshots were updated as well;
their URLs are derived from `.name`.
Adds regression tests for the member name, the alias, and the naming of all
`rfc-*` members - `_test_knows_value()` only proved that a value is
known, never that its member name is spelled correctly.
Resolves #1074
Signed-off-by: 皇者华 <328654030+BLDT-36@users.noreply.github.com>
---
cyclonedx/model/__init__.py | 5 +++--
.../enum_ExternalReferenceType-1.1.xml.bin | 2 +-
.../enum_ExternalReferenceType-1.2.json.bin | 2 +-
.../enum_ExternalReferenceType-1.2.xml.bin | 2 +-
.../enum_ExternalReferenceType-1.3.json.bin | 2 +-
.../enum_ExternalReferenceType-1.3.xml.bin | 2 +-
.../enum_ExternalReferenceType-1.4.json.bin | 2 +-
.../enum_ExternalReferenceType-1.4.xml.bin | 2 +-
.../enum_ExternalReferenceType-1.5.json.bin | 2 +-
.../enum_ExternalReferenceType-1.5.xml.bin | 2 +-
.../enum_ExternalReferenceType-1.6.json.bin | 2 +-
.../enum_ExternalReferenceType-1.6.xml.bin | 2 +-
.../enum_ExternalReferenceType-1.7.json.bin | 2 +-
.../enum_ExternalReferenceType-1.7.xml.bin | 2 +-
tests/test_enums.py | 15 +++++++++++++++
15 files changed, 31 insertions(+), 15 deletions(-)
diff --git a/cyclonedx/model/__init__.py b/cyclonedx/model/__init__.py
index f949e10c..df34af86 100644
--- a/cyclonedx/model/__init__.py
+++ b/cyclonedx/model/__init__.py
@@ -514,7 +514,8 @@ class ExternalReferenceType(str, Enum):
POAM = 'poam' # Only supported in >= 1.5
QUALITY_METRICS = 'quality-metrics' # Only supported in >= 1.5
RELEASE_NOTES = 'release-notes' # Only supported in >= 1.4
- RFC_9166 = 'rfc-9116' # Only supported in >= 1.6
+ RFC_9116 = 'rfc-9116' # Only supported in >= 1.6
+ RFC_9166 = 'rfc-9116' # deprecated alias of `RFC_9116` - kept for backward compatibility, see #1074
RISK_ASSESSMENT = 'risk-assessment' # Only supported in >= 1.5
RUNTIME_ANALYSIS_REPORT = 'runtime-analysis-report' # Only supported in >= 1.5
SECURITY_CONTACT = 'security-contact' # Only supported in >= 1.5
@@ -586,7 +587,7 @@ class _ExternalReferenceSerializationHelper(serializable.helpers.BaseHelper):
ExternalReferenceType.SOURCE_DISTRIBUTION,
ExternalReferenceType.ELECTRONIC_SIGNATURE,
ExternalReferenceType.DIGITAL_SIGNATURE,
- ExternalReferenceType.RFC_9166,
+ ExternalReferenceType.RFC_9116,
}
__CASES[SchemaVersion1Dot7] = __CASES[SchemaVersion1Dot6] | {
ExternalReferenceType.CITATION,
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.1.xml.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.1.xml.bin
index be2cf7e1..c08f748c 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.1.xml.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.1.xml.bin
@@ -111,7 +111,7 @@
tests/RELEASE_NOTES
- tests/RFC_9166
+ tests/RFC_9116
tests/RISK_ASSESSMENT
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.2.json.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.2.json.bin
index 6d578afd..338171a1 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.2.json.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.2.json.bin
@@ -145,7 +145,7 @@
},
{
"type": "other",
- "url": "tests/RFC_9166"
+ "url": "tests/RFC_9116"
},
{
"type": "other",
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.2.xml.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.2.xml.bin
index 5adf4c1c..8b9b37ea 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.2.xml.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.2.xml.bin
@@ -114,7 +114,7 @@
tests/RELEASE_NOTES
- tests/RFC_9166
+ tests/RFC_9116
tests/RISK_ASSESSMENT
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.3.json.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.3.json.bin
index 3c722e07..7b5b1917 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.3.json.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.3.json.bin
@@ -145,7 +145,7 @@
},
{
"type": "other",
- "url": "tests/RFC_9166"
+ "url": "tests/RFC_9116"
},
{
"type": "other",
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.3.xml.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.3.xml.bin
index 34d645a9..a815694e 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.3.xml.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.3.xml.bin
@@ -114,7 +114,7 @@
tests/RELEASE_NOTES
- tests/RFC_9166
+ tests/RFC_9116
tests/RISK_ASSESSMENT
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.4.json.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.4.json.bin
index bc4bb785..5450c12e 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.4.json.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.4.json.bin
@@ -145,7 +145,7 @@
},
{
"type": "other",
- "url": "tests/RFC_9166"
+ "url": "tests/RFC_9116"
},
{
"type": "other",
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.4.xml.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.4.xml.bin
index 92169a2f..4faab632 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.4.xml.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.4.xml.bin
@@ -113,7 +113,7 @@
tests/RELEASE_NOTES
- tests/RFC_9166
+ tests/RFC_9116
tests/RISK_ASSESSMENT
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.5.json.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.5.json.bin
index 45138436..e3bd093d 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.5.json.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.5.json.bin
@@ -145,7 +145,7 @@
},
{
"type": "other",
- "url": "tests/RFC_9166"
+ "url": "tests/RFC_9116"
},
{
"type": "risk-assessment",
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.5.xml.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.5.xml.bin
index b7f3bd44..4189aaac 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.5.xml.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.5.xml.bin
@@ -113,7 +113,7 @@
tests/RELEASE_NOTES
- tests/RFC_9166
+ tests/RFC_9116
tests/RISK_ASSESSMENT
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.6.json.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.6.json.bin
index f927ff82..fd357327 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.6.json.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.6.json.bin
@@ -145,7 +145,7 @@
},
{
"type": "rfc-9116",
- "url": "tests/RFC_9166"
+ "url": "tests/RFC_9116"
},
{
"type": "risk-assessment",
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.6.xml.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.6.xml.bin
index 53080af7..77825610 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.6.xml.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.6.xml.bin
@@ -113,7 +113,7 @@
tests/RELEASE_NOTES
- tests/RFC_9166
+ tests/RFC_9116
tests/RISK_ASSESSMENT
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.7.json.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.7.json.bin
index 9fcd274e..01a2e43d 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.7.json.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.7.json.bin
@@ -145,7 +145,7 @@
},
{
"type": "rfc-9116",
- "url": "tests/RFC_9166"
+ "url": "tests/RFC_9116"
},
{
"type": "risk-assessment",
diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.7.xml.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.7.xml.bin
index d053c269..9bfa10e3 100644
--- a/tests/_data/snapshots/enum_ExternalReferenceType-1.7.xml.bin
+++ b/tests/_data/snapshots/enum_ExternalReferenceType-1.7.xml.bin
@@ -113,7 +113,7 @@
tests/RELEASE_NOTES
- tests/RFC_9166
+ tests/RFC_9116
tests/RISK_ASSESSMENT
diff --git a/tests/test_enums.py b/tests/test_enums.py
index 94d0a99c..b3620988 100644
--- a/tests/test_enums.py
+++ b/tests/test_enums.py
@@ -272,6 +272,21 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any,
])
super()._test_cases_render(bom, of, sv)
+ def test_rfc_9116_is_spelled_correctly(self) -> None:
+ self.assertEqual('rfc-9116', ExternalReferenceType.RFC_9116.value)
+ self.assertEqual('RFC_9116', ExternalReferenceType.RFC_9116.name)
+ self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType('rfc-9116'))
+
+ def test_rfc_9166_is_a_deprecated_alias(self) -> None:
+ # the member was misspelled in earlier versions - it stays available as an alias
+ self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType.RFC_9166)
+
+ def test_rfc_members_follow_upper_snake_case_naming(self) -> None:
+ # `_test_knows_value()` only proves a value is known, not that its member name is spelled right
+ for member in ExternalReferenceType:
+ if member.value.startswith('rfc-'):
+ self.assertEqual(member.value.upper().replace('-', '_'), member.name)
+
@ddt
class TestEnumHashAlgorithm(_EnumTestCase):