Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

licenseChoice streamlined #205

Merged
merged 2 commits into from
May 29, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 36 additions & 31 deletions schema/bom-1.5.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,8 @@
"$ref": "#/definitions/organizationalEntity"
},
"licenses": {
"type": "array",
"title": "BOM License(s)",
"additionalItems": false,
"items": {"$ref": "#/definitions/licenseChoice"}
"$ref": "#/definitions/licenseChoice"
},
"properties": {
"type": "array",
Expand Down Expand Up @@ -404,9 +402,7 @@
"items": {"$ref": "#/definitions/hash"}
},
"licenses": {
"type": "array",
"additionalItems": false,
"items": {"$ref": "#/definitions/licenseChoice"},
"$ref": "#/definitions/licenseChoice",
"title": "Component License(s)"
},
"copyright": {
Expand Down Expand Up @@ -845,28 +841,41 @@
}
},
"licenseChoice": {
"type": "object",
"title": "License(s)",
"additionalProperties": false,
"properties": {
"license": {
"$ref": "#/definitions/license"
},
"expression": {
"type": "string",
"title": "SPDX License Expression",
"examples": [
"Apache-2.0 AND (MIT OR GPL-2.0-only)",
"GPL-3.0-only WITH Classpath-exception-2.0"
]
}
},
"oneOf":[
"type": "array",
"title": "License Choice",
"description": "EITHER (a list of SPDX and/or named licenses) OR (a list of one SPDX License Expression)",
"oneOf": [
{
"required": ["license"]
"description": "a list of SPDX and/or named licenses",
"items": {
"type": "object",
"required": ["license"],
"additionalProperties": false,
"properties": {
"license": {"$ref": "#/definitions/license"}
}
}
},
{
"required": ["expression"]
"description": "a list of one SPDX License Expression",
"additionalItems": false,
Copy link
Member Author

@jkowalleck jkowalleck May 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

defined items as a list(tuple!) with only one item and set additionalItems to false.
this causes validators and other to see: this list must have exactly one item with the defined predicates.

"minItems": 1,
"maxItems": 1,
"items": [{
"type": "object",
"required": ["expression"],
"additionalProperties": false,
"properties": {
"expression": {
"type": "string",
"title": "SPDX License Expression",
"examples": [
"Apache-2.0 AND (MIT OR GPL-2.0-only)",
"GPL-3.0-only WITH Classpath-exception-2.0"
]
}
}
}]
}
]
},
Expand Down Expand Up @@ -1216,9 +1225,7 @@
"description": "Specifies information about the data including the directional flow of data and the data classification."
},
"licenses": {
"type": "array",
"additionalItems": false,
"items": {"$ref": "#/definitions/licenseChoice"},
"$ref": "#/definitions/licenseChoice",
"title": "Component License(s)"
},
"externalReferences": {
Expand Down Expand Up @@ -1503,9 +1510,7 @@
}
},
"licenses": {
"type": "array",
"additionalItems": false,
"items": {"$ref": "#/definitions/licenseChoice"},
"$ref": "#/definitions/licenseChoice",
"title": "Component License(s)"
},
"copyright": {
Expand Down