Metadata-Version: 2.5
Name: reg-schema
Version: 2.0.0
Summary: project_data.json schema and structural validator
Project-URL: Homepage, https://github.com/adamaltmejd/registry-research-toolkit
Project-URL: Repository, https://github.com/adamaltmejd/registry-research-toolkit
Project-URL: Issues, https://github.com/adamaltmejd/registry-research-toolkit/issues
Author-email: Adam Altmejd <adam@altmejd.se>
License: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.14
Requires-Dist: pydantic>=2.13.4
Description-Content-Type: text/markdown

# reg_schema

`project_data.json` schema and structural validator. Importable by the webapp and the
SPA (via TS codegen).

Python ≥3.14. One runtime dependency: Pydantic v2 (the deliberate exception to the
workspace no-Pydantic rule); the structural validator itself operates on raw dicts and
needs no third-party deps. See [DESIGN.md](DESIGN.md) for scope and dependency
direction.

## Status

v2.0.0 — Model A grammar. The surface: the §6.8.0 cross-runtime contract
(`ValidationIssue`, `ValidationResult`), the Pydantic v2 models (`ProjectData`,
`Source`, `Binding`, `Panel`, `PanelMember`, `Period`, `PeriodRange`, `LiteralPeriod`,
plus the `EntityKey` / `TimeKey` / `TimePoint` aliases), and the unified
`validate_structural()` entrypoint implementing §6.8.1. See [DESIGN.md](DESIGN.md) for
the issue-code table.

```python
import json

from reg_schema import validate_structural

with open("project_data.json") as f:
    spec = json.load(f)

result = validate_structural(spec)
if not result.ok:
    for issue in result.issues:
        if issue.level == "error":
            print(f"{issue.path}: {issue.code} — {issue.message}")
```

The validator operates on a parsed dict, not on the Pydantic models, because rules like
"type is one of the enum values" must fire on raw JSON values before any `Literal` cast.
