Skip to content

license list: format json with the same structure as csv, text and md. #130

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Splizard
Copy link

@Splizard Splizard commented Jun 5, 2025

fixes #76, supports --summary, not entirely sure why the JSON structure is different, note that this is a breaking change to the format, so open to any suggestions/guidance on flags that should be introduced to control this behavior.

fixes CycloneDX#76, supports --summary, not entirely sure why the JSON structure
is different, note that this is a breaking change to the format, so open
to any suggestions/guidance on new flags that should be introduced to
control behaviour here.

Signed-off-by: Quentin Quaadgras <[email protected]>
@Splizard Splizard changed the title license list: format json with the same structure as CSV, text and md. license list: format json with the same structure as csv, text and md. Jun 5, 2025
@AeroqualHayden
Copy link

I'd love to be able to use the JSON functionality, this is super helpful, thanks @Splizard!
Is there anything extra that needs to happen to get this in @mrutkows?

@mrutkows
Copy link
Contributor

@Splizard will try to look at the PR next week after vacation, but the JSON was supposed to be true to the CycloneDX schema; whereas the "summary" was my own opinionated decision of what I believed was important to my company's CISO. Conceptually the JSON structs were supposed to only be CycloneDX to allow tools to extract the dat objects from one BOM and use them in another BOM.

@mrutkows
Copy link
Contributor

@Splizard Can we get together to discuss an approach to achieve what you like, but not create JSON that does not adhere to the CycloneDX schema?


for _, licenseName := range bom.LicenseMap.KeySet() {
arrLicenseInfo, _ := bom.LicenseMap.Get(licenseName)

for _, iInfo := range arrLicenseInfo {
licenseInfo = iInfo.(schema.LicenseInfo)
if licenseInfo.LicenseChoiceTypeValue != schema.LC_TYPE_INVALID {
lc = append(lc, licenseInfo.LicenseChoice)
line, err = prepareReportLineData(
Copy link
Contributor

@mrutkows mrutkows Jul 15, 2025

Choose a reason for hiding this comment

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

In alignment with my statements regarding that the JSON produced needs to match the CycloneDX schema (as the default), I believe the correct approach that achieves what you like (and set a precedent for other APIs as well) would be to conditionally generate the non-standard JSON output only if the --summary flag was also provided in addition the --format json flag and value.

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.

Feature Request - Generate JSON with entire structure
3 participants