Skip to content

Commit d6acb60

Browse files
authored
feat!: remove spdx expression validation (#1382)
<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅 You can expedite processing of your PR by using this template to provide context and additional information. Before actually opening a PR please make sure that it does NOT fall into any of the following categories 🚫 Spam PRs (accidental or intentional) - these will result in a 30-days or even ∞ ban from interacting with the project depending on reoccurrence and severity. 🚫 Lazy typo fixing PRs - if you fix a typo in a file, your PR will only be merged if all other typos in the same file are also fixed with the same PR 🚫 If you fail to provide any _Description_ below, your PR will be considered spam. If you do not check the _Affirmation_ box below, your PR will not be merged. 🚫 If you do not check one of the _AI Tool Disclosure_ boxes below, your PR will not be merged. If you used AI tools to assist you in writing code, but fail to provide the required disclosure, your PR will not be merged. 🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅--> ### Description <!-- ✍️--> * Constructor of `Contrib.License.Factories.LicenseFactory` got an injectable argument `spdxExpressionValidate` for validating SPDX Expressions * Dependency `spdx-expression-parse` became a suggested (optional peer-dependency) library Used as an injectable in `Contrib.License.Factories.LicenseFactory.constructor`. Resolves or fixes issue: <!-- ✍️ Add GitHub issue number in format `#0000` or `none` --> ### AI Tool Disclosure - [x] My contribution does not include any AI-generated content - [ ] My contribution includes AI-generated content, as disclosed below: - AI Tools: `[e.g. GitHub CoPilot, ChatGPT, JetBrains Junie etc.]` - LLMs and versions: `[e.g. GPT-4.1, Claude Haiku 4.5, Gemini 2.5 Pro etc.]` - Prompts: `[Summarize the key prompts or instructions given to the AI tools]` ### Affirmation - [x] My code follows the [CONTRIBUTING.md](https://github.com/CycloneDX/cyclonedx-javascript-library/blob/main/CONTRIBUTING.md) guidelines --------- Signed-off-by: Jan Kowalleck <jan.kowalleck@gmail.com>
1 parent b71be48 commit d6acb60

16 files changed

Lines changed: 70 additions & 28 deletions

File tree

HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,12 @@ All notable changes to this project will be documented in this file.
5959
* Symbol `Contrib.FromNodePackageJson.Factories.PackageUrlFactory` ([#1348] via [#1378])
6060
* Changed
6161
* `Component.purl` is a `string` now, was `PackaheUrl` ([#1348] via [#1379])
62+
* Constructor of `Contrib.License.Factories.LicenseFactory` got an injectable argument `spdxExpressionValidate` for validating SPDXExpressions ([#1348] via [#1382])
63+
Suggested implementation is `spdx-expression-parse`.
6264
* Dependencies
6365
* No longer depend on `packageurl-js@^2.0.1` ([#1348] via [#1378])
66+
* Dependency `spdx-expression-parse` became a suggested (optional peer-dependency) library ([#1348] via [#1382])
67+
Used as an injectable in `Contrib.License.Factories.LicenseFactory.constructor`.
6468
* Build
6569
* Use _webpack_ `5.105.2` now, was `v5.103.0` (via [#1360], [#1374])
6670
* Chore
@@ -75,6 +79,7 @@ All notable changes to this project will be documented in this file.
7579
[#1378]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1378
7680
[#1379]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1379
7781
[#1380]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1380
82+
[#1382]: https://github.com/CycloneDX/cyclonedx-javascript-library/pull/1382
7883

7984
## 9.4.1 -- 2025-12-04
8085

examples/node/javascript/example.cjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ const CDX = require('@cyclonedx/cyclonedx-library')
2525
// const { Bom, Component } = require('@cyclonedx/cyclonedx-library/Models')
2626
// const { ComponentType } = require('@cyclonedx/cyclonedx-library/Enums')
2727

28-
const lFac = new CDX.Contrib.License.Factories.LicenseFactory()
28+
const spdxExpressionParser = require('spdx-expression-parse')
29+
30+
31+
const lFac = new CDX.Contrib.License.Factories.LicenseFactory(spdxExpressionParser)
2932

3033
const bom = new CDX.Models.Bom()
3134
bom.metadata.component = new CDX.Models.Component(

examples/node/javascript/example.mjs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ import * as CDX from '@cyclonedx/cyclonedx-library'
2525
// import { Bom, Component } from '@cyclonedx/cyclonedx-library/Models'
2626
// import { ComponentType } from '@cyclonedx/cyclonedx-library/Enums'
2727

28-
const lFac = new CDX.Contrib.License.Factories.LicenseFactory()
28+
import spdxExpressionParser from 'spdx-expression-parse'
29+
30+
31+
const lFac = new CDX.Contrib.License.Factories.LicenseFactory(spdxExpressionParser)
2932

3033
const bom = new CDX.Models.Bom()
3134
bom.metadata.component = new CDX.Models.Component(

examples/node/javascript/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"dependencies": {
1010
"@cyclonedx/cyclonedx-library": "file:../../..",
11+
"spdx-expression-parse": "^3.0.1||^4",
1112
"xmlbuilder2": "^3.0.2||^4.0.0"
1213
},
1314
"optionalDependencies": {

examples/node/typescript/example.cjs/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"dependencies": {
1010
"@cyclonedx/cyclonedx-library": "file:../../../..",
11+
"spdx-expression-parse": "^3.0.1||^4",
1112
"xmlbuilder2": "^3.0.2||^4.0.0"
1213
},
1314
"optionalDependencies": {
@@ -18,6 +19,7 @@
1819
},
1920
"devDependencies": {
2021
"@types/node": "*",
22+
"@types/spdx-expression-parse": "^3",
2123
"typescript": "^3.8 || ^4 || ^5"
2224
},
2325
"scripts": {

examples/node/typescript/example.cjs/src/example.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ import * as CDX from '@cyclonedx/cyclonedx-library'
2525
// import { Bom, Component } from '@cyclonedx/cyclonedx-library/Models'
2626
// import { ComponentType } from '@cyclonedx/cyclonedx-library/Enums'
2727

28-
const lFac = new CDX.Contrib.License.Factories.LicenseFactory()
28+
import * as spdxExpressionParser from 'spdx-expression-parse'
29+
30+
31+
const lFac = new CDX.Contrib.License.Factories.LicenseFactory(spdxExpressionParser)
2932

3033
const bom = new CDX.Models.Bom()
3134
bom.metadata.component = new CDX.Models.Component(

examples/node/typescript/example.mjs/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
},
99
"dependencies": {
1010
"@cyclonedx/cyclonedx-library": "file:../../../..",
11+
"spdx-expression-parse": "^3.0.1||^4",
1112
"xmlbuilder2": "^3.0.2||^4.0.0"
1213
},
1314
"optionalDependencies": {
@@ -18,6 +19,7 @@
1819
},
1920
"devDependencies": {
2021
"@types/node": "*",
22+
"@types/spdx-expression-parse": "^3",
2123
"typescript": "^4 || ^5"
2224
},
2325
"scripts": {

examples/node/typescript/example.mjs/src/example.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ import * as CDX from '@cyclonedx/cyclonedx-library'
2525
// import { Bom, Component } from '@cyclonedx/cyclonedx-library/Models'
2626
// import { ComponentType } from '@cyclonedx/cyclonedx-library/Enums'
2727

28-
const lFac = new CDX.Contrib.License.Factories.LicenseFactory()
28+
import spdxExpressionParser from 'spdx-expression-parse'
29+
30+
31+
const lFac = new CDX.Contrib.License.Factories.LicenseFactory(spdxExpressionParser)
2932

3033
const bom = new CDX.Models.Bom()
3134
bom.metadata.component = new CDX.Models.Component(

examples/web/parcel/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"license": "Apache-2.0",
55
"source": "src/index.html",
66
"dependencies": {
7-
"@cyclonedx/cyclonedx-library": "file:../../.."
7+
"@cyclonedx/cyclonedx-library": "file:../../..",
8+
"spdx-expression-parse": "^3.0.1||^4"
89
},
910
"devDependencies": {
1011
"parcel": "^2"

examples/web/parcel/src/app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ Copyright (c) OWASP Foundation. All Rights Reserved.
2222
const CDX = require('@cyclonedx/cyclonedx-library')
2323
// full Library is available as `CDX`, now
2424

25-
const lFac = new CDX.Contrib.License.Factories.LicenseFactory()
25+
const spdxExpressionParser = require('spdx-expression-parse')
26+
27+
28+
const lFac = new CDX.Contrib.License.Factories.LicenseFactory(spdxExpressionParser)
2629

2730
const bom = new CDX.Models.Bom()
2831
bom.metadata.component = new CDX.Models.Component(

0 commit comments

Comments
 (0)