Validation: JSON Schemas + validator (the discipline, enforced)
The README claimed 'validated by JSON Schema' — now it is true. /schemas holds a JSON Schema for each entity type (Person, Body, Candidate, Jurisdiction): a stricter profile over OKF's permissive base, tolerating unknown keys by design. scripts/validate.py checks all 17,506 files with no third-party deps (hand-rolled frontmatter parser + minimal schema engine): 1. OKF conformance — every file has frontmatter with a non-empty type 2. Schema conformance — required fields, property types, enums 3. Link integrity — internal /-rooted links resolve Non-zero exit on failure, so it is a CI gate. Verified with a negative test: it catches bad enums and dead links. All 17,506 files pass today. Makefile ties it together: make build / validate / check. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"title": "Jurisdiction",
|
||||
"description": "A place with a government — a county or congressional district — carrying demographic context. A node in the fractal jurisdiction tree.",
|
||||
"type": "object",
|
||||
"required": ["type", "title", "classification", "confidence", "tags", "timestamp"],
|
||||
"properties": {
|
||||
"type": { "type": "string", "enum": ["Jurisdiction"] },
|
||||
"title": { "type": "string" },
|
||||
"classification": { "type": "string", "enum": ["county", "congressional-district"] },
|
||||
"fips": { "type": "string" },
|
||||
"state": { "type": "string" },
|
||||
"district": { "type": "string" },
|
||||
"demographics": { "type": "object" },
|
||||
"sources": { "type": "array" },
|
||||
"confidence": { "type": "string", "enum": ["official", "reported", "inferred", "unverified"] },
|
||||
"tags": { "type": "array" },
|
||||
"timestamp": { "type": "string" }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user