mirror of
https://github.com/anchore/syft.git
synced 2025-11-17 16:33:21 +01:00
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.goand comment out invocations of thevalidateAgainstV1Schemafunction. - 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
validateAgainstV1Schemafunction.