mirror of
https://github.com/anchore/syft
synced 2024-11-10 14:24:12 +00:00
a5cba13ddf
Signed-off-by: Alex Goodman <alex.goodman@anchore.com> |
||
---|---|---|
.. | ||
cyclonedx | ||
json | ||
README.md |
Updating the JSON schema
Today the JSON schema is generated from integration test data. Specifically, when integration tests are run, the /schema/json/examples
directory is populated with syft JSON output data. This examples directory is used to drive automatically generating the JSON schema.
The caveats with this approach is:
- the JSON schema is only as good as the examples provided
- there is an integration test that ensures that the JSON schema is valid relative to what the code currently generates. This means to update the JSON schema you need to
- Open up
test/integration/json_schema_test.go
and comment out invocations of thevalidateAgainstV1Schema
function. - From the root of the repo run
generate-json-schema
. Now there should be a new schema generated at/schema/json/schema.json
- Uncomment the
validateAgainstV1Schema
function.