forked from EduCraft/curriculum-project-hub
752a5c661d
Declarative JSON Schema per kind (segment/example/lemma/sop), embedded as real .json artifacts (ADR-0006) and validated by a small hand-rolled interpreter (properties/required/type/enum/additionalProperties + the `x-cph-content` marker) — no jsonschema-crate churn for a one-optional-string scalar surface. `x-cph-content: true` marks content fields (not in element.toml; require sibling <field>.typ); everything else is an element.toml scalar. `validate(desc)` is self-contained: UnknownKind for unknown kinds, MissingContentFile (path named in message) for absent required .typ, SchemaViolation for bad scalars; lemma proof optional ⇒ no diagnostic when absent. 8 tests green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
12 lines
279 B
JSON
12 lines
279 B
JSON
{
|
|
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
"$id": "cph:kind/segment",
|
|
"title": "segment",
|
|
"type": "object",
|
|
"properties": {
|
|
"textbook": { "type": "string", "x-cph-content": true }
|
|
},
|
|
"required": ["textbook"],
|
|
"additionalProperties": false
|
|
}
|