Skip to content

feat: add correctly spelled ExternalReferenceType.RFC_9116 - #1082

Open
buzludeniz wants to merge 3 commits into
CycloneDX:mainfrom
buzludeniz:fix/rfc-9116-enum-member
Open

buzludeniz wants to merge 3 commits into
CycloneDX:mainfrom
buzludeniz:fix/rfc-9116-enum-member

Conversation

@buzludeniz

Copy link
Copy Markdown

Description

ExternalReferenceType.RFC_9166 holds the value rfc-9116 (the security.txt RFC), but its name has the RFC
number wrong. As noted in the issue, renaming the member would be a breaking change, so this PR adds the correct
name as an enum alias instead:

  • ExternalReferenceType.RFC_9116 is the same member as RFC_9166: same value, the same object, and found by
    value (ExternalReferenceType('rfc-9116')) and by name.
  • Nothing existing changes. RFC_9166 stays the canonical name, so iteration, .name, serialization and the
    test snapshots are unchanged.
  • The class docstring says to prefer RFC_9116. Making it the canonical name (and dropping RFC_9166) could
    wait for the next major version.
  • The schema-version map in _ExternalReferenceSerializationHelper now uses RFC_9116.
  • New test: TestEnumExternalReferenceType.test_rfc_9116_is_alias_of_rfc_9166.

The full test suite passes, and so do flake8, mypy, isort, bandit and deptry.

Resolves or fixes issue: #1074

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: Claude Code
    • LLMs and versions: Claude Opus 5.5
    • Prompts: Find a small open issue and fix it without a breaking change; add a test; run the test suite and the linters. The change and this description were reviewed by me before submitting.

Affirmation

`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 <denizalbania@gmail.com>
@buzludeniz
buzludeniz requested a review from a team as a code owner November 25, 2026 17:29
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@read-the-docs-community

read-the-docs-community Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Documentation build overview

📚 CycloneDX Python Library | 🛠️ Build #36211867 | 📁 Comparing 79cc298 against latest (76f51d0)

  🔍 Preview build  

2 files changed
± genindex.html
± autoapi/cyclonedx/model/index.html

@jkowalleck jkowalleck changed the title feat: add correctly spelled ExternalReferenceType.RFC_9116 feat: add correctly spelled ExternalReferenceType.RFC_9116 Nov 26, 2026
@jkowalleck jkowalleck added the bug Something isn't working label Nov 26, 2026

@jkowalleck jkowalleck left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this non-breaking fix.
Could you fix some nitpicks i had?

Comment thread cyclonedx/model/__init__.py Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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

Comment thread cyclonedx/model/__init__.py Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please define RFC_9116 first, RFC_9166 second

Comment thread cyclonedx/model/__init__.py Outdated
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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RFC_9166 = 'rfc-9116' # Only supported in >= 1.6 -- misspelled name, kept for backwards compatibility
RFC_9166 = 'rfc-9116' # Deprecated; use RFC_9116 instead. see https://github.com/CycloneDX/cyclonedx-python-lib/issues/1074

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 <denizalbania@gmail.com>
@buzludeniz

Copy link
Copy Markdown
Author

@jkowalleck thanks for the review. Both changes are in cabc4b6: RFC_9116 is defined first, and RFC_9166 is its deprecated alias.

I put the deprecation comment on the line above RFC_9166 rather than at the end of it, because the suggested line is 128 characters and flake8's limit here is 120. The wording and the #1074 link are the same.

The enum snapshot tests build each URL from the member's name, so 13 snapshot files changed from tests/RFC_9166 to tests/RFC_9116. Nothing else in them changed.

Comment thread cyclonedx/model/__init__.py Outdated
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
# Deprecated; use RFC_9116 instead. see https://github.com/CycloneDX/cyclonedx-python-lib/issues/1074

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please put this behind RFC_9166
feel free to split it in multiple lines - like so

RFC_9166 = 'rfc-9116' # Deprecated; use RFC_9116 instead.
                      # see https://github.com/CycloneDX/cyclonedx-python-lib/issues/1074

If this is still too long, just add a # noqa[E501] marker an the end of the line

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 79cc298: the note is now behind RFC_9166, on one line with # noqa: E501. I tried the two-line version first, but flake8 flags the aligned second comment line (E114 and E116), so I went with the noqa marker.

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 <denizalbania@gmail.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] ExternalReferenceType misspells 'rfc-9116' enum member as RFC_9166 instead of RFC_9116

2 participants