Files
curriculum-project-hub/crates/cph-schema/schemas/example.json
T
sjfhsjfh 752a5c661d feat(checker): cph-schema — 4 kind JSON Schemas + validation (WU-3)
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>
2026-06-22 01:33:40 +08:00

14 lines
386 B
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "cph:kind/example",
"title": "example",
"type": "object",
"properties": {
"problem": { "type": "string", "x-cph-content": true },
"solution": { "type": "string", "x-cph-content": true },
"source": { "type": "string" }
},
"required": ["problem", "solution"],
"additionalProperties": false
}