Skip to content

Commit fe7d695

Browse files
committed
fix empty licenses in SPDX conversion
Signed-off-by: andreas hilti <[email protected]>
1 parent 6bffc9a commit fe7d695

15 files changed

+1
-70
lines changed

src/CycloneDX.Spdx.Interop/Converters/v2_3/Helpers/CycloneDXBomHelpers.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public static void AddSpdxPackages(this Bom bom, SpdxDocument doc)
147147
{
148148
component.Licenses = new List<LicenseChoice>();
149149
}
150-
else
150+
else if (package.LicenseDeclared != null)
151151
{
152152
component.Licenses = new List<LicenseChoice> { new LicenseChoice { Expression = package.LicenseDeclared } };
153153
}

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromCDXToSpdxToCDXRoundTripTest_assembly.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
"type": "library",
3232
"name": "acme-library-a",
3333
"version": "1.0.0",
34-
"licenses": [
35-
{}
36-
],
3734
"externalReferences": [
3835
{
3936
"url": "NOASSERTION",

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromCDXToSpdxToCDXRoundTripTest_bom.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,6 @@
9696
"author": "Example Super Heros",
9797
"name": "mylibrary",
9898
"version": "1.0.0",
99-
"licenses": [
100-
{}
101-
],
10299
"externalReferences": [
103100
{
104101
"url": "NOASSERTION",

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromCDXToSpdxToCDXRoundTripTest_component-hashes.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@
8181
"content": "26cdc7fb3fd65fc3b621a4ef70bc7d2489d5c19e70c76cf7ec20e538df0047cf"
8282
}
8383
],
84-
"licenses": [
85-
{}
86-
],
8784
"externalReferences": [
8885
{
8986
"url": "NOASSERTION",

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromCDXToSpdxToCDXRoundTripTest_component-ref.snap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
"type": "library",
3232
"name": "acme-library",
3333
"version": "1.0.0",
34-
"licenses": [
35-
{}
36-
],
3734
"externalReferences": [
3835
{
3936
"url": "NOASSERTION",
@@ -55,9 +52,6 @@
5552
"type": "library",
5653
"name": "acme-library",
5754
"version": "1.0.0",
58-
"licenses": [
59-
{}
60-
],
6155
"externalReferences": [
6256
{
6357
"url": "NOASSERTION",

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromCDXToSpdxToCDXRoundTripTest_component-swid-full.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
"author": "Acme Super Heros",
3333
"name": "Acme Application",
3434
"version": "9.1.1",
35-
"licenses": [
36-
{}
37-
],
3835
"externalReferences": [
3936
{
4037
"url": "NOASSERTION",

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromCDXToSpdxToCDXRoundTripTest_component-swid.snap

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232
"author": "Acme Super Heros",
3333
"name": "Acme Application",
3434
"version": "9.1.1",
35-
"licenses": [
36-
{}
37-
],
3835
"externalReferences": [
3936
{
4037
"url": "NOASSERTION",

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromCDXToSpdxToCDXRoundTripTest_component-types.snap

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
"type": "application",
3232
"name": "application-a",
3333
"version": "1.0",
34-
"licenses": [
35-
{}
36-
],
3734
"externalReferences": [
3835
{
3936
"url": "NOASSERTION",
@@ -55,9 +52,6 @@
5552
"type": "library",
5653
"name": "library-a",
5754
"version": "1.0",
58-
"licenses": [
59-
{}
60-
],
6155
"externalReferences": [
6256
{
6357
"url": "NOASSERTION",
@@ -79,9 +73,6 @@
7973
"type": "framework",
8074
"name": "framework-a",
8175
"version": "1.0",
82-
"licenses": [
83-
{}
84-
],
8576
"externalReferences": [
8677
{
8778
"url": "NOASSERTION",
@@ -103,9 +94,6 @@
10394
"type": "container",
10495
"name": "container-a",
10596
"version": "1.0",
106-
"licenses": [
107-
{}
108-
],
10997
"externalReferences": [
11098
{
11199
"url": "NOASSERTION",
@@ -127,9 +115,6 @@
127115
"type": "operating-system",
128116
"name": "operating-system-a",
129117
"version": "1.0",
130-
"licenses": [
131-
{}
132-
],
133118
"externalReferences": [
134119
{
135120
"url": "NOASSERTION",
@@ -151,9 +136,6 @@
151136
"type": "firmware",
152137
"name": "firmware-a",
153138
"version": "1.0",
154-
"licenses": [
155-
{}
156-
],
157139
"externalReferences": [
158140
{
159141
"url": "NOASSERTION",

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromCDXToSpdxToCDXRoundTripTest_compositions.snap

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
"type": "library",
3232
"name": "Partner Shaded Library",
3333
"version": "1.0",
34-
"licenses": [
35-
{}
36-
],
3734
"externalReferences": [
3835
{
3936
"url": "NOASSERTION",
@@ -55,9 +52,6 @@
5552
"type": "library",
5653
"name": "Acme Library",
5754
"version": "3.0",
58-
"licenses": [
59-
{}
60-
],
6155
"externalReferences": [
6256
{
6357
"url": "NOASSERTION",

tests/CycloneDX.Spdx.Interop.Tests/__snapshots__/ConverterTests.FromCDXToSpdxToCDXRoundTripTest_dependency.snap

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
"type": "library",
3232
"name": "library-a",
3333
"version": "1.0.0",
34-
"licenses": [
35-
{}
36-
],
3734
"externalReferences": [
3835
{
3936
"url": "NOASSERTION",
@@ -55,9 +52,6 @@
5552
"type": "library",
5653
"name": "library-b",
5754
"version": "1.0.0",
58-
"licenses": [
59-
{}
60-
],
6155
"externalReferences": [
6256
{
6357
"url": "NOASSERTION",
@@ -79,9 +73,6 @@
7973
"type": "library",
8074
"name": "library-c",
8175
"version": "1.0.0",
82-
"licenses": [
83-
{}
84-
],
8576
"externalReferences": [
8677
{
8778
"url": "NOASSERTION",

0 commit comments

Comments
 (0)