Skip to content

fix: convert license expressions, fix conversion issues#283

Open
kzantow wants to merge 3 commits intospdx:spdx3from
kzantow-anchore:fix/convert-licenses
Open

fix: convert license expressions, fix conversion issues#283
kzantow wants to merge 3 commits intospdx:spdx3from
kzantow-anchore:fix/convert-licenses

Conversation

@kzantow
Copy link
Copy Markdown
Collaborator

@kzantow kzantow commented Apr 13, 2026

This PR primarily corrects an issue where all licenses were converted from 2.3 to 3.0 as SimpleLicenses. Now, complex licenses are converted to the conjunctive/disjunctive license structures.

While working on this, I noticed tests were erroneously passing due to not comparing the Elements list. After discussion with implementors, it seems that Elements are where all elements should go which are not the direct subject of a collection and this should contain all elements in collection's object graph. As an example, an SpdxDocument has Elements and RootElements, an SBOM would typically be the sole entry in the RootElements, the SBOM RootElements has a root package, say a package which represents the container. Relationships are added to the Elements list and this ends up being the only way to reference related packages and other related information. In addition to that, the Elements properties would contain the container package -- all the way up the object graph to the SpdxDocument.Element property. Now, any ElementCollection automatically has it's Elements collection flattened and deduplicated during serialization. These Element lists are also tested as part of the diffing process.

kzantow added 2 commits April 3, 2026 16:12
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Signed-off-by: Keith Zantow <kzantow@gmail.com>
Bundle{},
} {
out = append(out,
cmpopts.IgnoreFields(t, "Elements"),
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing a lot of stuff to be missed in the diff.

Signed-off-by: Keith Zantow <kzantow@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant