Skip to content

feat: add isExternal property to Component for CycloneDX v1.7#959

Open
tonal wants to merge 1 commit intoCycloneDX:mainfrom
tonal:main
Open

feat: add isExternal property to Component for CycloneDX v1.7#959
tonal wants to merge 1 commit intoCycloneDX:mainfrom
tonal:main

Conversation

@tonal
Copy link
Copy Markdown

@tonal tonal commented Apr 12, 2026

Implement the isExternal boolean property on Component as specified in CycloneDX v1.7 schema. An external component is one that is not part of an assembly, but is expected to be provided by the environment.

  • Add is_external property to Component class with XML attribute serialization
  • Create XmlBoolAttribute serialization helper for proper bool handling (JSON: native bool, XML: lowercase string)
  • Add 6 unit tests for is_external (default value, set/get, equality, sorting)
  • Add test fixture and 14 snapshots for JSON/XML output across schema versions
  • Supports v1.7+ schemas only

Description

Adds the isExternal property to Component as defined in the CycloneDX v1.7 XML/JSON schema. This property indicates that a component is external to the organization and expected to be provided by the deployment environment. The implementation includes a custom serialization helper (XmlBoolAttribute) to handle the difference between JSON (native boolean) and XML (lowercase string attribute) serialization requirements.

Resolves or fixes issue: #903

AI Tool Disclosure

  • My contribution does not include any AI-generated content
  • My contribution includes AI-generated content, as disclosed below:
    • AI Tools: Qwen Code (CLI agent)
    • LLMs and versions: Qwen (latest)
    • Prompts: Implement isExternal property for Component per CycloneDX v1.7 spec, including tests and snapshots

Affirmation

Implement the isExternal boolean property on Component as specified in
CycloneDX v1.7 schema. An external component is one that is not part of
an assembly, but is expected to be provided by the environment.

- Add is_external property to Component class with XML attribute serialization
- Create XmlBoolAttribute serialization helper for proper bool handling
- Add unit tests for is_external (default value, set/get, equality, sorting)
- Add test fixture and snapshots for JSON/XML output
- Supports v1.7+ schemas only

Implements: CycloneDX#903

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Signed-off-by: Alexandr N Zamaraev (aka tonal) <tonal@promsoft.ru>
@tonal tonal requested a review from a team as a code owner April 12, 2026 08:08
@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 18 complexity · 0 duplication

Metric Results
Complexity 18
Duplication 0

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 CycloneDX Python Library | 🛠️ Build #32220790 | 📁 Comparing 1480a09 against latest (d04d043)

  🔍 Preview build  

Show files changed (3 files in total): 📝 3 modified | ➕ 0 added | ➖ 0 deleted
File Status
genindex.html 📝 modified
autoapi/cyclonedx/serialization/index.html 📝 modified
autoapi/cyclonedx/model/component/index.html 📝 modified

@jkowalleck jkowalleck added the enhancement New feature or request label Apr 12, 2026
@jkowalleck
Copy link
Copy Markdown
Member

Thank you so much for contributing this feature, @tonal.
The implementation looks promising at first glance.
A detailed review and merge will take a bit of time, so stay tuned.

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

Labels

enhancement New feature or request schema 1.7

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants