Back to Grype

`db-diff` JSON Schema

schema/grype/db-diff/json/README.md

0.112.01.3 KB
Original Source

db-diff JSON Schema

This is the JSON schema for output from the grype db diff command. The required inputs for defining the JSON schema are as follows:

  • the value of grype/db/v6/diff.SchemaVersion that governs the schema version
  • the Result type definition within github.com/anchore/grype/grype/db/v6/diff/result.go that governs the overall document shape

Versioning

Versioning the JSON schema must be done manually by changing the SchemaVersion constant within grype/db/v6/diff/schema.go.

Follow semver guidelines for incrementing the version.

Generating a New Schema

Create the new schema by running make generate-json-schema from the root of the repo:

  • If there is not an existing schema for the given version, then the new schema file will be written to schema/grype/db-diff/json/schema-$VERSION.json
  • If there is an existing schema for the given version and the new schema matches the existing schema, no action is taken
  • If there is an existing schema for the given version and the new schema does not match the existing schema, an error is shown indicating to increment the version appropriately (see the "Versioning" section)

Note: never delete a JSON schema and never change an existing JSON schema once it has been published in a release! Only add new schemas with a newly incremented version.