Repository navigation
Conversation
Add the CycloneDX 1.7 patent data models: - `cyclonedx.model.patent` with `Patent`, `PatentFamily`, `PatentAssertion`, `PriorityApplication` and enums `PatentLegalStatus`, `PatentAssertionType` - `Definitions.patents` - `Component.patent_assertions` and `Service.patent_assertions` All of these are rendered for CycloneDX >= 1.7 only. `Bom.definitions` is no longer rendered empty, when none of its parts is available in the target schema version. Part of CycloneDX#903 Assisted-by: AI coding assistant (reviewed and tested by the author) Signed-off-by: Nare <[email protected]>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 164 |
| Duplication | 0 |
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.
|
📖 7 files changed · 1 added · 6 modified
Preview · build overview · CycloneDX Python Library · built Dec. 4, 2026, 2 p.m. UTC |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds support for CycloneDX 1.7 patent information, one of the open items of the v1.7 tracking ticket.
cyclonedx.model.patent:Patent,PatentFamily,PatentAssertion,PriorityApplicationPatentLegalStatus,PatentAssertionTypeDefinitions.patents(mixed list ofPatentandPatentFamily; patents sort before families)Component.patent_assertionsandService.patent_assertions@serializable.view(SchemaVersion1Dot7))Bom.definitionsnow goes through a small helper so that no emptydefinitionsis renderedwhen none of its parts are available in the target version (e.g. patents only, rendered as 1.6)
patentAssertionsI had to shift thexml_sequencenumbers aftercopyright(Component) and afterlicenses(Service) by one.Existing snapshots are unchanged.
Serialization notes / points for review:
patentAssigneeis a plain array of entity/contact in JSON, but a repeatedorganizationOrIndividualType(<organization>/<individual>wrapper) in XML. py-serializablecan't emit repeated sibling elements from one helper. So the assignees are rendered into a
temporary container that the
definitions.patentshelper unwraps (and re-wraps when deserializing).Downside: calling
Patent.as_xml()directly, outside thedefinitions.patentscontext, producesthat container. I'm open to a different approach if you prefer one.
asserter(entity | contact | ref) andpatentAssigneeitems in JSON carry no explicitdiscriminator. On deserialization, an object with
emailorphonebecomes anOrganizationalContact, and anything else becomes anOrganizationalEntity.oneOfoverorganizationalEntityandorganizationalContact, so an object with onlyname(and/orbom-ref) matches both and failsvalidation. The XML is fine because of the wrapper elements. Should this be reported to the specification repo?
patentNumber/jurisdictionpatterns yet. Schema validation catches them.Happy to add it if you want it.
bom-refs are not added toBomRefDiscriminator(same asStandard).Tests: new fixtures
get_bom_with_patentsandget_bom_with_definitions_patents_only(snapshots forall versions, JSON+XML schema validation, deserialization round-trip), enum tests for both new enums,
and unit tests in
tests/test_model_patent.py.Resolves or fixes issue: part of #903
AI Tool Disclosure
Grok Bot (autonomous coding assistant agent)not exposed by the toolImplement CycloneDX 1.7 patent support (Patent, PatentFamily, definitions.patents, patentAssertions on Component/Service, 1.7-only) following the existing model/serialization/test conventions of this repo; add fixtures, snapshots and unit tests; run flake8/mypy/isort/bandit and the full test suite.I reviewed the code and ran all tests and linters locally.
Affirmation