cyclonedx-cli
cyclonedx-cli copied to clipboard
Validate doesn't tell you why the format isn't any good or where the problem is
docker run -v .:/mnt/mydata cyclonedx/cyclonedx-cli validate --input-file /mnt/mydata/bcdx.json Unable to validate against any JSON schemas. BOM is not valid.
that is not helpful
I found that --fail-on-errors provides a tiny bit more information. Not really good but at least better.
For more verbose validation errors, I've found check-jsonschema (and also on pypi), to be useful; e.g. if I add a field not supported by the schema such as invalid_field_name
I get:
$ check-jsonschema --schemafile /path/to/bom-1.4.schema.json bom.json
Schema validation errors were encountered.
.validate_piped_input.txt::$.components[0].supplier.contact[0]: Additional properties are not allowed ('invalid_field_name' was unexpected)
Note this only checks that the BOM is syntactically correct, not that the values are correct; for instance, it won't check to see that your dependencies
section points to things which exist (but then, neither does the cyclonedx-cli
tool). Hope this helps.
This should be improved by release 0.26.0.