Skip to content

Commit 345c32c

Browse files
committed
component's version and versionRange exclusively
Signed-off-by: Jan Kowalleck <[email protected]>
1 parent 919e49f commit 345c32c

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

schema/bom-1.7.proto

+10-10
Original file line numberDiff line numberDiff line change
@@ -106,16 +106,16 @@ message Component {
106106
optional string group = 7;
107107
// The name of the component. This will often be a shortened, single name of the component. Examples: commons-lang3 and jquery
108108
string name = 8;
109-
oneof version_choice {
110-
// The component version. The version should ideally comply with semantic versioning but is not enforced.
111-
// Version was made optional in v1.4 of the spec.
112-
// For backward compatibility, it is recommended to use an empty string to represent components without version information.
113-
string version = 9;
114-
// For an external component, this specifies the accepted version range.
115-
// The value must adhere to the Package URL Version Range syntax (vers), as defined at https://github.com/package-url/purl-spec/blob/master/VERSION-RANGE-SPEC.rst.
116-
// May only be used if `isExternal` is set to `true`.
117-
string versionRange = 33;
118-
}
109+
// The component version. The version should ideally comply with semantic versioning but is not enforced.
110+
// Version was made optional in v1.4 of the spec.
111+
// For backward compatibility, it is recommended to use an empty string to represent components without version information.
112+
// This field must be used exclusively, either 'version' or 'versionRange', but not both.
113+
string version = 9;
114+
// For an external component, this specifies the accepted version range.
115+
// The value must adhere to the Package URL Version Range syntax (vers), as defined at https://github.com/package-url/purl-spec/blob/master/VERSION-RANGE-SPEC.rst.
116+
// May only be used if `isExternal` is set to `true`.
117+
// M>ust be used exclusively, either 'version' or 'versionRange', but not both.
118+
optional string versionRange = 33;
119119
// Specifies a description for the component
120120
optional string description = 10;
121121
// Specifies the scope of the component. If a scope is not specified, SCOPE_REQUIRED scope should be assumed by the consumer of the BOM

schema/bom-1.7.schema.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -923,12 +923,12 @@
923923
"version": {
924924
"$ref": "#/definitions/version",
925925
"title": "Component Version",
926-
"description": "The component version. The version should ideally comply with semantic versioning but is not enforced."
926+
"description": "The component version. The version should ideally comply with semantic versioning but is not enforced.\nMust be used exclusively, either 'version' or 'versionRange', but not both."
927927
},
928928
"versionRange": {
929929
"$ref": "#/definitions/versionRange",
930930
"title": "Component Version Range",
931-
"description": "For an external component, this specifies the accepted version range.\nThe value must adhere to the Package URL Version Range syntax (vers), as defined at <https://github.com/package-url/purl-spec/blob/master/VERSION-RANGE-SPEC.rst>.\nMay only be used if `.isExternal` is set to `true`."
931+
"description": "For an external component, this specifies the accepted version range.\nThe value must adhere to the Package URL Version Range syntax (vers), as defined at <https://github.com/package-url/purl-spec/blob/master/VERSION-RANGE-SPEC.rst>.\nMay only be used if `.isExternal` is set to `true`.\nThis field must be used exclusively, either 'version' or 'versionRange', but not both."
932932
},
933933
"isExternal": {
934934
"type": "boolean",

schema/bom-1.7.xsd

+3
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,9 @@ limitations under the License.
555555
</xs:annotation>
556556
</xs:element>
557557
<xs:choice minOccurs="0" maxOccurs="1">
558+
<xs:annotation>
559+
<xs:documentation>Must be used exclusively, either 'version' or 'versionRange', but not both.</xs:documentation>
560+
</xs:annotation>
558561
<xs:element name="version" type="bom:versionType">
559562
<xs:annotation>
560563
<xs:documentation>The component version. The version should ideally comply with semantic versioning

0 commit comments

Comments
 (0)