From 150297186a2a98748520b26d19b1c17c8d3acc94 Mon Sep 17 00:00:00 2001 From: buzludeniz Date: Wed, 25 Nov 2026 09:36:41 -0700 Subject: [PATCH 1/3] feat: add correctly spelled `ExternalReferenceType.RFC_9116` `RFC_9166` misspells the RFC number of its value `rfc-9116`. Add `RFC_9116` as an alias of the same member, and keep `RFC_9166` as the canonical name so that nothing breaks. Signed-off-by: buzludeniz --- cyclonedx/model/__init__.py | 10 ++++++++-- tests/test_enums.py | 7 +++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/cyclonedx/model/__init__.py b/cyclonedx/model/__init__.py index f949e10ce..b8614030b 100644 --- a/cyclonedx/model/__init__.py +++ b/cyclonedx/model/__init__.py @@ -478,6 +478,11 @@ class ExternalReferenceType(str, Enum): .. note:: See the CycloneDX Schema definition: https://cyclonedx.org/docs/1.7/xml/#type_externalReferenceType + + .. note:: + ``RFC_9116`` (for ``security.txt``, see RFC 9116) and ``RFC_9166`` are the same member. + ``RFC_9166`` is a misspelled name kept for backwards compatibility; use ``RFC_9116`` instead. + The member's ``name`` stays ``RFC_9166`` until the next major version. """ # see `_ExternalReferenceSerializationHelper.__CASES` for view/case map ADVERSARY_MODEL = 'adversary-model' # Only supported in >= 1.5 @@ -514,7 +519,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_9166 = 'rfc-9116' # Only supported in >= 1.6 -- misspelled name, kept for backwards compatibility + RFC_9116 = 'rfc-9116' # Only supported in >= 1.6 -- alias of `RFC_9166` under the correct RFC number 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 +592,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/test_enums.py b/tests/test_enums.py index 94d0a99cd..da72e43de 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -272,6 +272,13 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, ]) super()._test_cases_render(bom, of, sv) + def test_rfc_9116_is_alias_of_rfc_9166(self) -> None: + # see https://github.com/CycloneDX/cyclonedx-python-lib/issues/1074 + self.assertIs(ExternalReferenceType.RFC_9166, ExternalReferenceType.RFC_9116) + self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType('rfc-9116')) + self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType['RFC_9116']) + self.assertEqual('rfc-9116', ExternalReferenceType.RFC_9116.value) + @ddt class TestEnumHashAlgorithm(_EnumTestCase): From cabc4b684ea2b44609d815ec901151626592e0ca Mon Sep 17 00:00:00 2001 From: Deniz Ikili Date: Thu, 26 Nov 2026 12:39:05 -0700 Subject: [PATCH 2/3] refactor: define `RFC_9116` first and deprecate `RFC_9166` Make `RFC_9116` the canonical member and `RFC_9166` its deprecated alias, as asked in review. Both names still resolve to the same member, so existing code keeps working; the member's `name` is now `RFC_9116`. The enum snapshots build each URL from the member's name, so the `tests/RFC_9166` URL in them becomes `tests/RFC_9116`. Signed-off-by: Deniz Ikili --- cyclonedx/model/__init__.py | 8 ++++---- .../snapshots/enum_ExternalReferenceType-1.1.xml.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.2.json.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.2.xml.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.3.json.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.3.xml.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.4.json.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.4.xml.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.5.json.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.5.xml.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.6.json.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.6.xml.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.7.json.bin | 2 +- .../snapshots/enum_ExternalReferenceType-1.7.xml.bin | 2 +- tests/test_enums.py | 9 +++++---- 15 files changed, 22 insertions(+), 21 deletions(-) diff --git a/cyclonedx/model/__init__.py b/cyclonedx/model/__init__.py index b8614030b..5fcab0899 100644 --- a/cyclonedx/model/__init__.py +++ b/cyclonedx/model/__init__.py @@ -481,8 +481,7 @@ class ExternalReferenceType(str, Enum): .. note:: ``RFC_9116`` (for ``security.txt``, see RFC 9116) and ``RFC_9166`` are the same member. - ``RFC_9166`` is a misspelled name kept for backwards compatibility; use ``RFC_9116`` instead. - The member's ``name`` stays ``RFC_9166`` until the next major version. + ``RFC_9166`` is a deprecated alias with a misspelled RFC number; use ``RFC_9116`` instead. """ # see `_ExternalReferenceSerializationHelper.__CASES` for view/case map ADVERSARY_MODEL = 'adversary-model' # Only supported in >= 1.5 @@ -519,8 +518,9 @@ 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 -- misspelled name, kept for backwards compatibility - RFC_9116 = 'rfc-9116' # Only supported in >= 1.6 -- alias of `RFC_9166` under the correct RFC number + RFC_9116 = 'rfc-9116' # Only supported in >= 1.6 + # Deprecated; use RFC_9116 instead. see https://github.com/CycloneDX/cyclonedx-python-lib/issues/1074 + RFC_9166 = 'rfc-9116' 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 diff --git a/tests/_data/snapshots/enum_ExternalReferenceType-1.1.xml.bin b/tests/_data/snapshots/enum_ExternalReferenceType-1.1.xml.bin index be2cf7e1a..c08f748c4 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 6d578afd1..338171a15 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 5adf4c1c1..8b9b37ea8 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 3c722e075..7b5b19172 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 34d645a90..a815694e7 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 bc4bb7857..5450c12eb 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 92169a2f6..4faab6326 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 451384363..e3bd093de 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 b7f3bd447..4189aaaca 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 f927ff82b..fd3573271 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 53080af7e..77825610d 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 9fcd274e9..01a2e43de 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 d053c269f..9bfa10e3b 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 da72e43de..ae050bab1 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -272,12 +272,13 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, ]) super()._test_cases_render(bom, of, sv) - def test_rfc_9116_is_alias_of_rfc_9166(self) -> None: + def test_rfc_9166_is_deprecated_alias_of_rfc_9116(self) -> None: # see https://github.com/CycloneDX/cyclonedx-python-lib/issues/1074 - self.assertIs(ExternalReferenceType.RFC_9166, ExternalReferenceType.RFC_9116) + self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType.RFC_9166) self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType('rfc-9116')) - self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType['RFC_9116']) - self.assertEqual('rfc-9116', ExternalReferenceType.RFC_9116.value) + self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType['RFC_9166']) + self.assertEqual('RFC_9116', ExternalReferenceType.RFC_9166.name) + self.assertEqual('rfc-9116', ExternalReferenceType.RFC_9166.value) @ddt From 79cc2986f63769a1e76c60ec9ac33aaebcd7d817 Mon Sep 17 00:00:00 2001 From: Deniz Ikili Date: Fri, 27 Nov 2026 06:21:26 -0700 Subject: [PATCH 3/3] style: put the `RFC_9166` deprecation note behind the member Move the deprecation comment to the end of the `RFC_9166` line, as asked in review. The line is longer than flake8's 120 characters, so it carries `# noqa: E501`. A second comment line aligned under the first fails flake8's E114 and E116, so the note stays on one line. Signed-off-by: Deniz Ikili --- cyclonedx/model/__init__.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cyclonedx/model/__init__.py b/cyclonedx/model/__init__.py index 5fcab0899..fca88b21f 100644 --- a/cyclonedx/model/__init__.py +++ b/cyclonedx/model/__init__.py @@ -519,8 +519,7 @@ class ExternalReferenceType(str, Enum): QUALITY_METRICS = 'quality-metrics' # Only supported in >= 1.5 RELEASE_NOTES = 'release-notes' # Only supported in >= 1.4 RFC_9116 = 'rfc-9116' # Only supported in >= 1.6 - # Deprecated; use RFC_9116 instead. see https://github.com/CycloneDX/cyclonedx-python-lib/issues/1074 - RFC_9166 = 'rfc-9116' + RFC_9166 = 'rfc-9116' # Deprecated; use RFC_9116 instead. see https://github.com/CycloneDX/cyclonedx-python-lib/issues/1074 # noqa: E501 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