Files
zhuangang/schema/frontmatter.schema.json
T

26 lines
1.6 KiB
JSON

{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "zhuangang/frontmatter.schema.json",
"title": "zhuangang 内容文件的 frontmatter",
"description": "plan/、topics/、scenarios/ 下每个 .md 文件开头的 YAML frontmatter。说明见 CONTRIBUTING.md。",
"type": "object",
"required": ["id", "title", "type", "domain"],
"properties": {
"id": {"type": "string", "pattern": "^[a-z0-9]+(\\.[a-z0-9-]+)+$", "description": "全局唯一、稳定不变的内容 ID"},
"title": {"type": "string"},
"type": {"enum": ["index", "lesson", "scenario", "interview", "project", "week", "research"]},
"domain": {"enum": ["backend", "devops", "python", "ai", "frontend", "cs", "cross", "plan"]},
"stack": {"type": "array", "items": {"type": "string"}, "description": "技术栈标识,与 topics/<domain>/<stack>/ 目录名一致"},
"tags": {"type": "array", "items": {"type": "string"}},
"level": {"enum": ["basic", "intermediate", "advanced"]},
"prerequisites": {"type": "array", "items": {"type": "string"}, "description": "先修内容的 id"},
"related": {"type": "array", "items": {"type": "string"}, "description": "相关内容的 id"},
"est_hours": {"type": "number", "minimum": 0},
"week": {"type": "array", "items": {"type": "integer", "minimum": 1, "maximum": 16}, "description": "在 16 周计划中的哪几周用到"},
"order": {"type": "integer", "description": "同一技术栈内的排序"}
},
"allOf": [
{"if": {"properties": {"type": {"enum": ["lesson", "scenario", "interview"]}}}, "then": {"required": ["level", "stack"]}}
]
}