Skip to content

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

@jkowalleck

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;
    }

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions