-
-
Notifications
You must be signed in to change notification settings - Fork 66
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
Conversation
267b21c
to
a6bd10d
Compare
Coverage summary from CodacySee diff coverage on Codacy
Coverage variation details
Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: Diff coverage details
Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: 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 |
There was a problem hiding this 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.:
cyclonedx-core-java/src/main/java/org/cyclonedx/parsers/JsonParser.java
Lines 172 to 179 in e2f7db6
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.
a6bd10d
to
d06844e
Compare
Done as well in a separate commit. |
d06844e
to
0bb9da9
Compare
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>
0bb9da9
to
8ce47b8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sschuberth!
This allows things like iterating over the supported file formats for a given version, and generating all BOM file formats for it.