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

Teach versions / generators about their supported file formats #445

Merged
merged 4 commits into from
Jul 15, 2024

Conversation

sschuberth
Copy link
Contributor

This allows things like iterating over the supported file formats for a given version, and generating all BOM file formats for it.

Copy link

codacy-production bot commented Jul 3, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.03% 77.14%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (e2f7db6) 5928 4332 73.08%
Head commit (8ce47b8) 5952 (+24) 4348 (+16) 73.05% (-0.03%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#445) 35 27 77.14%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences


🚀 Don’t miss a bit, follow what’s new on Codacy.

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Copy link
Member

@nscuro nscuro left a comment

Choose a reason for hiding this comment

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

For consistency, please consider adding similar checks to the validation side of things, e.g.:

public List<ParseException> validate(final JsonNode bomJson, final Version schemaVersion) throws IOException {
final List<ParseException> exceptions = new ArrayList<>();
Set<ValidationMessage> errors = getJsonSchema(schemaVersion, mapper).validate(mapper.readTree(bomJson.toString()));
for (ValidationMessage message: errors) {
exceptions.add(new ParseException(message.getMessage()));
}
return exceptions;
}

Trying to validate a JSON BOM for schema versions below 1.2 should also fail.

@sschuberth
Copy link
Contributor Author

For consistency, please consider adding similar checks to the validation side of things

Done as well in a separate commit.

@sschuberth sschuberth requested a review from nscuro July 11, 2024 10:09
This allows things like iterating over the supported file formats for a
given version, and generating all BOM file formats for it.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
@sschuberth sschuberth requested a review from nscuro July 11, 2024 16:54
@nscuro nscuro added the enhancement New feature or request label Jul 15, 2024
Copy link
Member

@nscuro nscuro left a comment

Choose a reason for hiding this comment

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

Thanks @sschuberth!

@nscuro nscuro merged commit 78d667e into CycloneDX:master Jul 15, 2024
9 checks passed
@sschuberth sschuberth deleted the file-format-enum branch July 15, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants