Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,41 @@ json = kcidb_io.new()
kcidb_io.schema.validate(json)
```

Exporting the JSON schema
-------------------------

The current schema is available as a JSON Schema dictionary on the version
class. The latest schema is exposed as `kcidb_io.schema.LATEST`.

Export the latest schema to a file:

```bash
python3 - <<'PY'
import json
from kcidb_io import schema

v = schema.LATEST
with open(f"kcidb-io.schema.v{v.major}.{v.minor}.json", "w") as f:
json.dump(v.json, f, indent=2, sort_keys=True)
PY
```

Compatibility notes
-------------------

The schema is validated in this library using JSON Schema Draft-07. The
exported schema JSON does not include a `$schema` field; if a validator
requires one, add:

```json
{
"$schema": "http://json-schema.org/draft-07/schema#"
}
```

The schema uses `$defs` and the `uri` string format. If your validator supports
format checking, enable it to validate `uri` values.

Hacking
-------

Expand Down