文件
edu-content/sources/source.schema.json

51 行
2.5 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "edu-content source registry",
"description": "机器可读的 L1 资源清单。一个 YAML 文件 = 一个域,内含多条 source。source 是四层血缘链的根 id。",
"type": "object",
"required": ["sources"],
"additionalProperties": false,
"properties": {
"sources": {
"type": "array",
"items": { "$ref": "#/definitions/source" }
}
},
"definitions": {
"source": {
"type": "object",
"required": ["id", "title", "publisher", "type", "license", "status"],
"additionalProperties": false,
"properties": {
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$", "description": "全局唯一 kebab-case,血缘链根 id" },
"title": { "type": "string" },
"publisher": { "type": "string" },
"type": { "type": "string", "enum": ["dataset", "website", "book", "internal", "tool"] },
"url": { "type": ["string", "null"], "description": "internal 可为 null" },
"license": { "type": "string", "enum": ["official-free", "cc-by", "cc-by-sa", "cc-nc-education", "restricted", "internal-only", "llm-generated", "unknown"] },
"license_note": { "type": "string" },
"fetch_method": { "type": "string", "enum": ["curl", "git-clone", "manual-download", "manual-export", "generated"], "description": "unknown 允许暂存" },
"status": { "type": "string", "enum": ["planned", "fetching", "fetched", "failed", "archived"] },
"fetched_at": { "type": ["string", "null"], "pattern": "^\\d{4}-\\d{2}-\\d{2}$|^$" },
"items": { "type": "array", "items": { "$ref": "#/definitions/item" } }
}
},
"item": {
"type": "object",
"required": ["id", "title"],
"additionalProperties": false,
"properties": {
"id": { "type": "string", "pattern": "^[a-z0-9][a-z0-9-]*$", "description": "source 内唯一" },
"title": { "type": "string" },
"oss_key": { "type": ["string", "null"], "description": "fetched 后必填,形如 edu-raw/exams/ket/vocab/cambridge-official/a2-key-vocab.pdf" },
"sha256": { "type": ["string", "null"], "pattern": "^[a-f0-9]{64}$|^$" },
"size": { "type": ["integer", "null"], "minimum": 0 },
"media_type": { "type": "string" },
"fetch_date": { "type": ["string", "null"], "pattern": "^\\d{4}-\\d{2}-\\d{2}$|^$" },
"status": { "type": "string", "enum": ["planned", "fetching", "fetched", "failed", "archived"] },
"note": { "type": "string" }
}
}
}
}