Python SDK
Local validation of INHERIT estate documents with bundled schemas. Supports Level 1 (schema) and Level 2 (referential integrity) conformance checking.
Installation#
bash
pip install openinheritRequires Python 3.11 or later. Dependencies (jsonschema, referencing, pydantic) are installed automatically.
Quick start#
python
from openinherit import validate
result = validate(document)
if result["valid"]:
print(f"Valid — conformance level {result['conformanceLevel']}")
else:
for error in result["errors"]:
print(f" {error['path']}: {error['message']}")API reference#
validate(document, mode=None, level=1)#
Validates an INHERIT document against the bundled v3 JSON Schema (Draft 2020-12).
Parameters:
document— the document to validate. Accepts adict, a JSONstr, orbytesmode—"estate","catalogue", orNone(auto-detect from$schemafield). Default:Nonelevel— conformance level to check.1= JSON Schema only,2= schema + referential integrity. Default:1
Returns: a dict with the following keys:
| Key | Type | Description |
|---|---|---|
valid |
bool |
Whether the document passed validation |
schemaMode |
str |
"estate" or "catalogue" |
conformanceLevel |
int |
0 (failed), 1 (schema valid), or 2 (schema + refs valid) |
errors |
list[dict] |
Each error has path and message keys |
disclaimer |
str |
Legal disclaimer |
Conformance levels#
| Level | What it checks | When to use |
|---|---|---|
| 1 (default) | JSON Schema validation — required fields, types, enums, formats | Quick checks, data import pipelines |
| 2 | Schema + referential integrity — every UUID cross-reference resolves to an entity in the document | Before submission to registries or courts, final document sign-off |
Examples#
Validate a file from disk#
python
import json
from pathlib import Path
from openinherit import validate
doc = json.loads(Path("estate.json").read_text())
result = validate(doc)
print("Valid" if result["valid"] else "Invalid")Level 2 validation#
python
from openinherit import validate
result = validate(document, level=2)
if result["conformanceLevel"] == 2:
print("Fully conformant — all cross-references resolve")
elif result["conformanceLevel"] == 1:
print("Schema valid but broken references:")
for err in result["errors"]:
if err.get("level") == 2:
print(f" {err['path']}: {err['message']}")Force catalogue mode#
python
from openinherit import validate
result = validate(catalogue_doc, mode="catalogue")