aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin Chadwell <me@jedevc.com>2022-12-05 12:12:05 +0000
committerJustin Chadwell <me@jedevc.com>2022-12-05 12:12:05 +0000
commitfe9bc5fc34d357646142914e0538fd4c3bafa298 (patch)
treeb5e403a3c279ab50fba3516ed34452ad55b55690
parent8a01147e63424f8f431278b90cdd73f6fe798f8d (diff)
downloadspdx-tools-fe9bc5fc34d357646142914e0538fd4c3bafa298.tar.gz
json: add omitempty tag to comment fields
Tags are marked as optional by the spec, so we should avoid writing the field on JSON output if it's unset. Signed-off-by: Justin Chadwell <me@jedevc.com>
-rw-r--r--spdx/v2_1/creation_info.go2
-rw-r--r--spdx/v2_1/package.go2
-rw-r--r--spdx/v2_2/creation_info.go2
-rw-r--r--spdx/v2_2/package.go2
-rw-r--r--spdx/v2_3/creation_info.go2
-rw-r--r--spdx/v2_3/package.go2
6 files changed, 6 insertions, 6 deletions
diff --git a/spdx/v2_1/creation_info.go b/spdx/v2_1/creation_info.go
index f4c4f41..0e1bd87 100644
--- a/spdx/v2_1/creation_info.go
+++ b/spdx/v2_1/creation_info.go
@@ -22,5 +22,5 @@ type CreationInfo struct {
// 2.10: Creator Comment
// Cardinality: optional, one
- CreatorComment string `json:"comment"`
+ CreatorComment string `json:"comment,omitempty"`
}
diff --git a/spdx/v2_1/package.go b/spdx/v2_1/package.go
index 4bf5636..dc61ff6 100644
--- a/spdx/v2_1/package.go
+++ b/spdx/v2_1/package.go
@@ -116,5 +116,5 @@ type PackageExternalReference struct {
// 3.22: Package External Reference Comment
// Cardinality: conditional (optional, one) for each External Reference
- ExternalRefComment string `json:"comment"`
+ ExternalRefComment string `json:"comment,omitempty"`
}
diff --git a/spdx/v2_2/creation_info.go b/spdx/v2_2/creation_info.go
index d56d9a5..70e611f 100644
--- a/spdx/v2_2/creation_info.go
+++ b/spdx/v2_2/creation_info.go
@@ -22,5 +22,5 @@ type CreationInfo struct {
// 6.10: Creator Comment
// Cardinality: optional, one
- CreatorComment string `json:"comment"`
+ CreatorComment string `json:"comment,omitempty"`
}
diff --git a/spdx/v2_2/package.go b/spdx/v2_2/package.go
index 2ca4cb1..53dd3a2 100644
--- a/spdx/v2_2/package.go
+++ b/spdx/v2_2/package.go
@@ -129,5 +129,5 @@ type PackageExternalReference struct {
// 7.22: Package External Reference Comment
// Cardinality: conditional (optional, one) for each External Reference
- ExternalRefComment string `json:"comment"`
+ ExternalRefComment string `json:"comment,omitempty"`
}
diff --git a/spdx/v2_3/creation_info.go b/spdx/v2_3/creation_info.go
index 55fed3d..33b2caf 100644
--- a/spdx/v2_3/creation_info.go
+++ b/spdx/v2_3/creation_info.go
@@ -22,5 +22,5 @@ type CreationInfo struct {
// 6.10: Creator Comment
// Cardinality: optional, one
- CreatorComment string `json:"comment"`
+ CreatorComment string `json:"comment,omitempty"`
}
diff --git a/spdx/v2_3/package.go b/spdx/v2_3/package.go
index 7df331d..86ab08f 100644
--- a/spdx/v2_3/package.go
+++ b/spdx/v2_3/package.go
@@ -147,5 +147,5 @@ type PackageExternalReference struct {
// 7.22: Package External Reference Comment
// Cardinality: conditional (optional, one) for each External Reference
- ExternalRefComment string `json:"comment"`
+ ExternalRefComment string `json:"comment,omitempty"`
}