diff --git a/cyclonedx/model/__init__.py b/cyclonedx/model/__init__.py index f949e10c..fca88b21 100644 --- a/cyclonedx/model/__init__.py +++ b/cyclonedx/model/__init__.py @@ -478,6 +478,10 @@ 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 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 @@ -514,7 +518,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; 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 @@ -586,7 +591,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..ae050bab 100644 --- a/tests/test_enums.py +++ b/tests/test_enums.py @@ -272,6 +272,14 @@ def test_cases_render_valid(self, of: OutputFormat, sv: SchemaVersion, *_: Any, ]) super()._test_cases_render(bom, of, sv) + 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_9116, ExternalReferenceType.RFC_9166) + self.assertIs(ExternalReferenceType.RFC_9116, ExternalReferenceType('rfc-9116')) + 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 class TestEnumHashAlgorithm(_EnumTestCase):