diff options
author | Brandon Lum <lumjjb@gmail.com> | 2023-01-04 16:25:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-04 16:25:27 +0800 |
commit | d6f58551be3f8268f8dca718e501de24895fa5b2 (patch) | |
tree | a17b8ba7daa907224c8b87a0891e2822b1c17812 /spdx/v2_2 | |
parent | 7782317b3e7e06728ab21e196003a437bb4711c3 (diff) | |
parent | 6fe9d226281a9ea9947f44aa6e03fe9c589a8a42 (diff) | |
download | spdx-tools-d6f58551be3f8268f8dca718e501de24895fa5b2.tar.gz |
Merge pull request #174 from jedevc/json-tags
Ensure consistency between JSON struct tags across different SPDX versions
Diffstat (limited to 'spdx/v2_2')
-rw-r--r-- | spdx/v2_2/creation_info.go | 2 | ||||
-rw-r--r-- | spdx/v2_2/document.go | 14 | ||||
-rw-r--r-- | spdx/v2_2/package.go | 12 |
3 files changed, 14 insertions, 14 deletions
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/document.go b/spdx/v2_2/document.go index d4d4e50..31ac08b 100644 --- a/spdx/v2_2/document.go +++ b/spdx/v2_2/document.go @@ -53,13 +53,13 @@ type Document struct { DocumentComment string `json:"comment,omitempty"` CreationInfo *CreationInfo `json:"creationInfo"` - Packages []*Package `json:"packages"` - Files []*File `json:"files"` - OtherLicenses []*OtherLicense `json:"hasExtractedLicensingInfos"` - Relationships []*Relationship `json:"relationships"` - Annotations []*Annotation `json:"annotations"` - Snippets []Snippet `json:"snippets"` + Packages []*Package `json:"packages,omitempty"` + Files []*File `json:"files,omitempty"` + OtherLicenses []*OtherLicense `json:"hasExtractedLicensingInfos,omitempty"` + Relationships []*Relationship `json:"relationships,omitempty"` + Annotations []*Annotation `json:"annotations,omitempty"` + Snippets []Snippet `json:"snippets,omitempty"` // DEPRECATED in version 2.0 of spec - Reviews []*Review + Reviews []*Review `json:"-"` } diff --git a/spdx/v2_2/package.go b/spdx/v2_2/package.go index 88ae543..2d99e04 100644 --- a/spdx/v2_2/package.go +++ b/spdx/v2_2/package.go @@ -9,7 +9,7 @@ type Package struct { // NOT PART OF SPEC // flag: does this "package" contain files that were in fact "unpackaged", // e.g. included directly in the Document without being in a Package? - IsUnpackaged bool + IsUnpackaged bool `json:"-"` // 7.1: Package Name // Cardinality: mandatory, one @@ -45,14 +45,14 @@ type Package struct { // Cardinality: optional, one; default value is "true" if omitted FilesAnalyzed bool `json:"filesAnalyzed,omitempty"` // NOT PART OF SPEC: did FilesAnalyzed tag appear? - IsFilesAnalyzedTagPresent bool + IsFilesAnalyzedTagPresent bool `json:"-"` // 7.9: Package Verification Code PackageVerificationCode common.PackageVerificationCode `json:"packageVerificationCode"` // 7.10: Package Checksum: may have keys for SHA1, SHA256, SHA512 and/or MD5 // Cardinality: optional, one or many - PackageChecksums []common.Checksum `json:"checksums"` + PackageChecksums []common.Checksum `json:"checksums,omitempty"` // 7.11: Package Home Page // Cardinality: optional, one @@ -108,9 +108,9 @@ type Package struct { PackageAttributionTexts []string `json:"attributionTexts,omitempty"` // Files contained in this Package - Files []*File + Files []*File `json:"files,omitempty"` - Annotations []Annotation `json:"annotations"` + Annotations []Annotation `json:"annotations,omitempty"` } // PackageExternalReference is an External Reference to additional info @@ -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"` } |