fix: read shortcut fields: documentDescribes and hasFiles#201
Merged
fix: read shortcut fields: documentDescribes and hasFiles#201
Conversation
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
lumjjb
approved these changes
Mar 6, 2023
Collaborator
lumjjb
left a comment
There was a problem hiding this comment.
super cool implementation! lgtm
| func (p *Package) UnmarshalJSON(b []byte) error { | ||
| type pkg Package | ||
| type extras struct { | ||
| HasFiles []common.DocElementID `json:"hasFiles"` |
Collaborator
There was a problem hiding this comment.
ahhh i see this trick to pass the hasFiles up to unexposed fields, this is very cool :)
Contributor
|
This is great! Thanks @kzantow 🎉 |
7 tasks
wlynch
added a commit
to wlynch/apko
that referenced
this pull request
Dec 17, 2025
SPDX considers documentDescribes as a shortcut field - it is not present in SPDX Go types (even though it will unmarshal them correctly). However, if apko is presented an SBOM without a shortcut field, it will fail to extract out the package details, even though the SBOM is considered valid by SPDX standards. This adds support to look for the equivalent details in the DESCRIBES relationship. See spdx/tools-golang#201 for more context.
wlynch
added a commit
to wlynch/apko
that referenced
this pull request
Dec 17, 2025
SPDX considers documentDescribes as a shortcut field - it is not present in SPDX Go types (even though it will unmarshal them correctly). However, if apko is presented an SBOM without a shortcut field, it will fail to extract out the package details, even though the SBOM is considered valid by SPDX standards. This adds support to look for the equivalent details in the DESCRIBES relationship. See spdx/tools-golang#201 for more context.
wlynch
added a commit
to wlynch/apko
that referenced
this pull request
Dec 17, 2025
SPDX considers documentDescribes as a shortcut field - it is not present in SPDX Go types (even though it will unmarshal them correctly). However, if apko is presented an SBOM without a shortcut field, it will fail to extract out the package details, even though the SBOM is considered valid by SPDX standards. This adds support to look for the equivalent details in the DESCRIBES relationship. See spdx/tools-golang#201 for more context.
wlynch
added a commit
to wlynch/apko
that referenced
this pull request
Dec 17, 2025
SPDX considers documentDescribes as a shortcut field - it is not present in SPDX Go types (even though it will unmarshal them correctly). However, if apko is presented an SBOM without a shortcut field, it will fail to extract out the package details, even though the SBOM is considered valid by SPDX standards. This adds support to look for the equivalent details in the DESCRIBES relationship. See spdx/tools-golang#201 for more context.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The JSON schema has fields documentDescribes and hasFiles for packages. These are not part of the Go data model and are duplicates of using relationships. However, some tools are outputting these fields today and we need to be able to decode them. This PR adds support for decoding these fields and translating them into the appropriate relationships.
Fixes: #166
Fixes: #171