# JSON Schema

Summary: Schema 让“页面大概长这样”变成“页面必须长这样”，便于验证、生成和索引系统共享同一合同。

Last updated: 2026-03-12  
Version: v1.0.0  
Docs URL: https://pingfanfan.github.io/OpenWebsite/docs/json-schema/  
API URL: https://pingfanfan.github.io/OpenWebsite/api/pages/json-schema.json  
Schema URL: https://pingfanfan.github.io/OpenWebsite/schema/knowledge-page.schema.json

## Schema 目标

- 保证每个页面对象都带核心身份字段与更新时间。
- 保证每个 section 带 id、title、summary 和 content。
- 限制随意扩展字段，减少结构漂移。
- 让索引系统不依赖 HTML 就能消费正文。

## 核心字段

- `id`
- `url`
- `rawUrl`
- `apiUrl`
- `title`
- `summary`
- `lastUpdated`
- `version`
- `sections`

## Section 对象结构

```json
{
  "id": "required-fields",
  "title": "核心字段",
  "summary": "说明页面对象中必须保留的字段。",
  "content": [
    "id 是页面稳定标识，与 slug 对齐。",
    "sections 数组承载正文主内容。"
  ]
}
```

## 文件位置

- 主 schema: `/schema/knowledge-page.schema.json`
- 站点索引: `/api/site.json`
