feat(schema): 2.1 types, fragments, and JSON Schemas

Add the term, equation, value, and misconception registries
(src/model/course/glossary.rs) and the new optional fields on objectives,
targets, lectures, readings, bank options, and policy. Load registry
entries from objective files, glossary.yaml, and course.yaml, with one
definition site per id as for every other registry. Port every edit in
docs/design/2.1/build_schemas.py into the hand-written schema builders,
add glossary.schema.json, and test the generated schemas against the
targets; the only differences are two 2.0 spellings the code already had.

The 2.0 example fragments load and validate unchanged. The 2.1 example
bank gains `status: draft`, which every coursebank item requires.
tests/docs.rs skips docs/design/, which holds design records rather than
guide pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
alexmandClaude committed 2026-11-16 11:55:18 -05:00
1 parent 15175f64fd
commit 51a2fd235f
47 files changed
+10568 -55

No files matched your search

+175
View File
@@ -0,0 +1,175 @@
{
"$id": "https://coursebank.dev/schema/lecture.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"description": "One session: its readings, and the objectives it develops. A fragment of the course file, merged on load.",
"properties": {
"lectures": {
"additionalProperties": {
"additionalProperties": false,
"properties": {
"date": {
"description": "Date delivered.",
"pattern": "^\\d{4}-\\d{2}-\\d{2}$",
"type": "string"
},
"description": {
"description": "The lecture in two to four sentences, student-facing: what it covers and the arc its objectives follow. The lecture page opens with it. May reference other entries in braces, {term-...}, {eq-...}, {val-...}, {mis-...}, {t-...} or {lo-...}; the validator checks each resolves and the renderer replaces it (a term with its linked name, an equation inline, a value with its `say`, a target with its number).",
"type": "string"
},
"materials": {
"description": "Links the lecture page lists beside the readings: slides, the brief, notebooks, the recording. `slides_url` is the older single-link form and still loads.",
"items": {
"additionalProperties": false,
"properties": {
"kind": {
"enum": [
"slides",
"brief",
"notes",
"notebook",
"recording",
"homework",
"other"
],
"type": "string"
},
"title": {
"description": "Link text. Defaults to the kind.",
"type": "string"
},
"url": {
"description": "Where it lives.",
"minLength": 1,
"type": "string"
}
},
"required": [
"kind",
"url"
],
"type": "object"
},
"type": "array"
},
"readings": {
"description": "Readings assigned with this lecture, in the order you assign them. A plain string is the pre-schema form and still loads.",
"items": {
"oneOf": [
{
"description": "The pre-schema form: a citation, unparsed.",
"type": "string"
},
{
"additionalProperties": false,
"properties": {
"focus": {
"description": "What to take from it. This is the sentence a student report quotes. May reference other entries in braces, {term-...}, {eq-...}, {val-...}, {mis-...}, {t-...} or {lo-...}; the validator checks each resolves and the renderer replaces it (a term with its linked name, an equation inline, a value with its `say`, a target with its number).",
"minLength": 1,
"type": "string"
},
"locator": {
"description": "Where inside the work: §6.1, pp. 212-219, ch. 3.",
"minLength": 1,
"type": "string"
},
"minutes": {
"description": "Estimated reading time, for the lecture page's workload line.",
"minimum": 1,
"type": "integer"
},
"path": {
"description": "Joined to the reference's base_url to reach this location.",
"type": "string"
},
"ref": {
"description": "Citation key into `references`.",
"minLength": 1,
"type": "string"
},
"role": {
"description": "supplemental means offered but not separately assessed.",
"enum": [
"assigned",
"supplemental"
],
"type": "string"
},
"skip": {
"description": "What to gloss, and why it is out of scope. May reference other entries in braces, {term-...}, {eq-...}, {val-...}, {mis-...}, {t-...} or {lo-...}; the validator checks each resolves and the renderer replaces it (a term with its linked name, an equation inline, a value with its `say`, a target with its number).",
"minLength": 1,
"type": "string"
},
"summary": {
"description": "What the section contains. May reference other entries in braces, {term-...}, {eq-...}, {val-...}, {mis-...}, {t-...} or {lo-...}; the validator checks each resolves and the renderer replaces it (a term with its linked name, an equation inline, a value with its `say`, a target with its number).",
"minLength": 1,
"type": "string"
},
"targets": {
"description": "Target ids this reading serves. A student who misses one of these is pointed here, so the list is what makes study guidance specific. Cite targets rather than objectives: a section of a book backs a specific performance, and a reading list resolved from an objective would send a student the same six sections whichever part of it they missed.",
"items": {
"type": "string"
},
"type": "array"
},
"text": {
"description": "A pre-schema citation string, held unparsed.",
"minLength": 1,
"type": "string"
},
"url": {
"description": "Full URL, when base_url does not cover the location.",
"type": "string"
}
},
"required": [
"ref"
],
"type": "object"
}
]
},
"type": "array"
},
"slides_url": {
"type": "string"
},
"teaches": {
"description": "The objectives this session develops. Each named objective gains this lecture in its `lectures` list when the course is loaded, so the pair is declared once, here, while planning the lecture.",
"items": {
"type": "string"
},
"type": "array"
},
"title": {
"description": "Lecture title.",
"minLength": 1,
"type": "string"
},
"unit": {
"description": "Unit id.",
"type": "string"
}
},
"required": [
"title"
],
"type": "object"
},
"description": "Keyed by lecture id, conventionally one entry per file.",
"type": "object"
},
"schema_version": {
"description": "Declared in course.yaml; fragments inherit it.",
"type": [
"string",
"number"
]
}
},
"required": [
"lectures"
],
"title": "coursebank lecture file",
"type": "object"
}