Skip to content
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

feat: Add missing provides mapping to Dependency to comply with CycloneDX 1.6 spec #599

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vibe13
Copy link

@vibe13 vibe13 commented Jan 28, 2025

Following #565, this PR attempts to add the missing mapping to comply with the CycloneDX 1.6 spec for the "provides" field inside the Dependency object: https://cyclonedx.org/docs/1.6/json/#dependencies_items_provides.

@vibe13 vibe13 requested a review from a team as a code owner January 28, 2025 13:56
@vibe13 vibe13 force-pushed the add_provides_mapping branch from c05258b to d42bf3b Compare January 28, 2025 13:57
@vibe13 vibe13 force-pushed the add_provides_mapping branch from d42bf3b to 62a4ffc Compare February 11, 2025 10:47
@@ -60,6 +66,26 @@ public void addDependency(final Dependency dependency) {
}
}

@VersionFilter(Version.VERSION_16)
Copy link
Contributor

Choose a reason for hiding this comment

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

Version filter is only needed at the attribute level

@VersionFilter(Version.VERSION_16)
@JsonProperty("provides")
@JacksonXmlProperty(localName = "provides")
private List<Dependency> provides;
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be private List<BomReference> provides the provide is linked to a BomRef not to a dependency based on the spec

@@ -97,6 +97,13 @@ private void writeJSONDependenciesWithGenerator(final JsonGenerator generator, f
}
}
generator.writeEndArray();
Copy link
Contributor

Choose a reason for hiding this comment

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

Tests for both Generators and Parses should be included (for XML and JSON)

@@ -97,6 +97,13 @@ private void writeJSONDependenciesWithGenerator(final JsonGenerator generator, f
}
}
generator.writeEndArray();
if (CollectionUtils.isNotEmpty(dependency.getProvides())) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this works, better to check with the generator test to confirm

@vibe13 vibe13 force-pushed the add_provides_mapping branch from a358c91 to 4e13d3a Compare March 29, 2025 13:33
@vibe13
Copy link
Author

vibe13 commented Mar 29, 2025

@mr-zepol Hi, apologies for the very late reply, pushed some fixes after your review, thanks!

@vibe13 vibe13 requested a review from mr-zepol March 31, 2025 09:35
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.

2 participants