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

@@ -0,0 +1,161 @@
{
"$id": "https://coursebank.dev/schema/objective.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"additionalProperties": false,
"description": "One learning objective and the learning targets it decomposes into. A fragment of the course file, merged on load.",
"properties": {
"learning_objectives": {
"additionalProperties": {
"additionalProperties": false,
"properties": {
"assessed": {
"description": "Set false for an objective you teach but do not test; coverage reporting will stop flagging it as a gap. This exempts its targets too.",
"type": "boolean"
},
"lectures": {
"description": "Lecture ids that cover this.",
"items": {
"type": "string"
},
"type": "array"
},
"level_ceiling": {
"description": "Cognitive level. 1 = Remember (recalling terms, facts, and definitions); 2 = Understand (explaining ideas in your own words); 3 = Apply (using a procedure in a new situation); 4 = Analyze (taking a situation apart and relating the pieces); 5 = Evaluate/Create (judging alternatives or building something new)",
"maximum": 5,
"minimum": 1,
"type": "integer"
},
"order": {
"description": "Position in teaching order, low first. Derived since 2.0 from the position of this objective in a lecture's `teaches` list; an authored value still wins, and `coursebank migrate order` removes them.",
"minimum": 1,
"type": "integer"
},
"prerequisites": {
"description": "Objective ids that must come first. Cycles are rejected.",
"items": {
"type": "string"
},
"type": "array"
},
"tags": {
"description": "Free-form tags.",
"items": {
"type": "string"
},
"type": "array"
},
"text": {
"description": "The objective as a student would read it. Start with a verb.",
"minLength": 1,
"type": "string"
},
"unit": {
"type": "string"
}
},
"required": [
"text"
],
"type": "object"
},
"description": "Keyed by objective id, conventionally one entry per file. Its `lectures` list is derived from each lecture's `teaches`, so leave it out unless you prefer to declare it here.",
"type": "object"
},
"learning_targets": {
"additionalProperties": {
"additionalProperties": false,
"properties": {
"assessed": {
"description": "Set false for something you teach but do not test. An unassessed objective exempts its targets regardless.",
"type": "boolean"
},
"lectures": {
"description": "Lecture ids that cover this.",
"items": {
"type": "string"
},
"type": "array"
},
"level_ceiling": {
"description": "Cognitive level. 1 = Remember (recalling terms, facts, and definitions); 2 = Understand (explaining ideas in your own words); 3 = Apply (using a procedure in a new situation); 4 = Analyze (taking a situation apart and relating the pieces); 5 = Evaluate/Create (judging alternatives or building something new)",
"maximum": 5,
"minimum": 1,
"type": "integer"
},
"objective": {
"description": "The objective this target belongs to. Required: a target with no objective would be measured and never reported.",
"type": "string"
},
"order": {
"description": "Ignored since 2.0. An objective's targets are a set of question templates, not steps in a sequence — they are not taught in order and an exam samples from them — so a position asserts an order that does not exist. Where one target depends on another, say so with `prerequisites`. `coursebank migrate order` removes this.",
"minimum": 1,
"type": "integer"
},
"prerequisites": {
"description": "Target or objective ids that must come first. Cycles are rejected.",
"items": {
"type": "string"
},
"type": "array"
},
"tags": {
"description": "Free-form tags.",
"items": {
"type": "string"
},
"type": "array"
},
"text": {
"description": "The target as a student would read it. Start with a verb.",
"minLength": 1,
"type": "string"
}
},
"required": [
"text",
"objective"
],
"type": "object"
},
"description": "The targets of this file's objective, by id. A target with no `lectures` of its own inherits its objective's.",
"type": "object"
},
"schema_version": {
"description": "Declared in course.yaml; fragments inherit it.",
"type": [
"string",
"number"
]
},
"stimuli": {
"additionalProperties": {
"additionalProperties": false,
"properties": {
"asset": {
"description": "Path to an image.",
"type": "string"
},
"body": {
"description": "The stimulus text, in coursebank markup.",
"minLength": 1,
"type": "string"
},
"caption": {
"type": "string"
}
},
"required": [
"body"
],
"type": "object"
},
"description": "Shared passages, figures, or data that several items refer to.",
"type": "object"
}
},
"required": [
"learning_objectives"
],
"title": "coursebank objective file",
"type": "object"
}