Skip to content

[XML] license.id and license.name are optional #288

Closed

Description

@jkowalleck

based on https://cyclonedx.slack.com/archives/C01HBFNCNJ1/p1693586003544379
based on #133 & #330


In XML, the license.id AND license.name are optional(minOccurs="0"), and you have to chose one optional, meaning one must be omitted by choice, and the other one is optional.

<xs:choice>
<xs:element name="id" type="spdx:licenseId" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>A valid SPDX license ID</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="name" type="xs:normalizedString" minOccurs="0" maxOccurs="1">
<xs:annotation>
<xs:documentation>If SPDX does not define the license used, this field may be used to provide the license name</xs:documentation>
</xs:annotation>
</xs:element>
</xs:choice>

This appears to be unintended. In contrast,

  • JSON defines a choice of a mandatory field in this case:
    "oneOf": [
    {
    "required": ["id"]
    },
    {
    "required": ["name"]
    }
    ],
  • ProtoBuff defines a choice of a mandatory field:
    oneof license {
    // A valid SPDX license ID
    string id = 1;
    // If SPDX does not define the license used, this field may be used to provide the license name
    string name = 2;
    }

Activity

  1. changed the title [-][DRAFT] `license.id` and `license.name` are optional[/-] [+][DRAFT] XML: `license.id` and `license.name` are optional[/+] on Sep 2, 2023
  2. added a commit that references this issue on Sep 2, 2023
  3. jkowalleck commented on Sep 2, 2023

    @jkowalleck
    MemberAuthor

    test cases are here: #289

  4. changed the title [-][DRAFT] XML: `license.id` and `license.name` are optional[/-] [+]XML: `license.id` and `license.name` are optional[/+] on Sep 2, 2023
  5. changed the title [-]XML: `license.id` and `license.name` are optional[/-] [+][XML] `license.id` and `license.name` are optional[/+] on Sep 2, 2023
  6. jkowalleck commented on Sep 2, 2023

    @jkowalleck
    MemberAuthor

    proposed solution: remove minOccurs="0" maxOccurs="1" in XML, so that both are mandatory.

  7. added a commit that references this issue on Sep 8, 2023
    fe7512f
  8. linked a pull request that will close this issuefix #288 #292on Sep 8, 2023
  9. jkowalleck commented on Sep 8, 2023

    @jkowalleck
    MemberAuthor

    fix here: #292

  10. added this to the 1.6 milestone on Sep 9, 2023
  11. self-assigned this
    on Oct 15, 2023
  12. added
    CDX 1.0
    on Oct 15, 2023
  13. added a commit that references this issue on Feb 5, 2024
    46ff114
  14. jkowalleck commented on Feb 5, 2024

    @jkowalleck
    MemberAuthor

    @mtsfoni this was just merged. Thanks for bringing up this topic back then. 👍

  15. added a commit that references this issue on Apr 9, 2024
  16. added a commit that references this issue on Jan 27, 2026
  17. added 3 commits that reference this issue on Feb 23, 2026
    893f904
    9d42542
    1d5c493
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CDX 1.0defectvalidated

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions