Skip to content

Auto-generate bom-refs for models that currently get none (licenses, organizations, contacts, …) #1084

Done
0 of 1 issue completed

Description

@wiebe-vandendriessche

Context

BomRefDiscriminator guarantees that components, services and vulnerabilities always get a unique, non-empty bom-ref in the serialized output. Many other models can carry a bom-ref as well, but when none is set, none is written. This is the contract described in #861, which was never finished.

Related: #1068 (citation bom-refs are not collected by BomRefDiscriminator.from_bom()). In the discussion there, the same gap was found for the models listed below. Adding a model to from_bom() also means a value is generated when it has none, because discriminate() assigns one to every collected BomRef without a value. This issue covers that generation and its effect on the output.

Proposal

Generate a bom-ref at serialization time, as is already done for components, services and vulnerabilities, for:

  • OrganizationalEntity, OrganizationalContact, PostalAddress
  • DisjunctiveLicense, LicenseExpression, LicenseExpressionDetails
  • Occurrence (component evidence)
  • Standard, Requirement, Level (definitions)
  • ModelCard, EnergyProvider

The generated values are removed again after serialization, as for the existing models, so the in-memory model is not changed.

Consequences

  • Serialized output of BOMs that use these models gains generated bom-ref attributes. Snapshot tests need regenerating.
  • Other models with a bom-ref (e.g. Citation, ComponentData) can be added once they are on main.

Sub-issues

Sub-issues

0 of 1 Issues completed
Loading 1 sub-issues

Activity

  1. wiebe-vandendriessche commented on Nov 26, 2026

    @wiebe-vandendriessche
    ContributorAuthor

    @jkowalleck, before opening a PR we should decide on a design decision:

    discriminate() gives a generated value to every BomRef that has none. That is a problem when the same object is reused in several places (e.g. one DisjunctiveLicense on two components). The license has a single BomRef, so the same generated bom-ref is written twice, and XML schema validation rejects duplicate bom-refs (unique identity-constraint 'bom-ref'). BOMs that are valid today could become invalid after an upgrade.

    Options:

    I lean towards A. Which would you prefer? I'll follow your choice and note it in the PR.

  2. jkowalleck commented on Nov 27, 2026

    @jkowalleck
    Member

    converting to a discussion, so we can work in discussion threads on each individual aspect.

  3. locked and limited conversation to collaborators on Nov 27, 2026
  4. converted this issue into a discussion #1085 on Nov 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions