{
  "$schema": "https://pingfanfan.github.io/OpenWebsite/schema/knowledge-page.schema.json",
  "format": "knowledge-page",
  "id": "json-schema",
  "url": "https://pingfanfan.github.io/OpenWebsite/docs/json-schema/",
  "rawUrl": "https://pingfanfan.github.io/OpenWebsite/raw/json-schema.md",
  "apiUrl": "https://pingfanfan.github.io/OpenWebsite/api/pages/json-schema.json",
  "schemaUrl": "https://pingfanfan.github.io/OpenWebsite/schema/knowledge-page.schema.json",
  "title": "JSON Schema",
  "summary": "定义结构化页面对象和 section 数据合同。",
  "lastUpdated": "2026-03-12",
  "version": "v1.0.0",
  "audience": ["ai-agent", "crawler", "developer", "human"],
  "sourceOfTruth": "结构化页面对象的校验规则",
  "tags": ["schema", "validation", "json"],
  "sections": [
    {
      "id": "schema-goals",
      "title": "Schema 目标",
      "summary": "Schema 的目标是让关键字段足够稳定、足够明确。",
      "content": [
        "保证每个页面对象都带核心身份字段与更新时间。",
        "保证每个 section 都带 id、title、summary 和正文数组。",
        "限制随意扩展字段，减少不同页面的结构漂移。"
      ]
    },
    {
      "id": "required-fields",
      "title": "核心字段",
      "summary": "最低限度上，一个页面 JSON 至少要回答它是谁、从哪里来、有什么内容以及何时更新。",
      "content": [
        "id、url、rawUrl 和 apiUrl 用于建立页面身份和入口映射。",
        "title、summary、lastUpdated 和 version 用于表达最短语义和新鲜度。",
        "sections 数组是正文的主载体。"
      ]
    },
    {
      "id": "section-shape",
      "title": "Section 对象结构",
      "summary": "section 是最重要的检索单元，所以需要严格约束。",
      "content": [
        "section 对象至少包含 id、title、summary 和 content。",
        "content 使用字符串数组，便于程序直接按段消费。",
        "section id 应与 HTML anchor 保持一致。"
      ]
    },
    {
      "id": "schema-file",
      "title": "Schema 文件",
      "summary": "实际校验合同保存在独立 schema 文件中，而不是只存在说明文档里。",
      "content": [
        "主 schema 文件位于 /schema/knowledge-page.schema.json。",
        "站点索引文件位于 /api/site.json。",
        "生成工具和验证工具都应以 schema 文件为准。"
      ]
    }
  ],
  "relatedPages": [
    {
      "id": "page-template",
      "title": "页面模板",
      "url": "https://pingfanfan.github.io/OpenWebsite/docs/page-template/"
    },
    {
      "id": "retrieval-contract",
      "title": "检索与抓取契约",
      "url": "https://pingfanfan.github.io/OpenWebsite/docs/retrieval-contract/"
    }
  ]
}
