Skip to content

Commit

Permalink
feat: add usage of ui-schemas (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
moonRider authored Sep 18, 2024
1 parent 6171a44 commit 72af18b
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,3 +324,44 @@ params = {
```

</details>

# 类型使用

## JSONSchema

### FormSchema

定义 FormSchema 的格式,用来约束 Form 类(创建表单,详情表单,更新用的表单)
Schema 的格式

#### Usage

```json
{
"$schema": "https://cdn.jsdelivr.net/gh/byzanteam/taihaku-schemas/ui-schemas/form/schema.json",
"schema": {...},
"uiSchema": {...}
}
```

### TableSchema

定义 TableSchema 的格式,用来约束 Table 类 Schema 的格式

#### Usage

```json
{
"$schema": "https://cdn.jsdelivr.net/gh/byzanteam/taihaku-schemas/ui-schemas/table/schema.json",
"columns": {...},
"uiSchema": {...}
}
```

## TS 类型

通常在通过请求取得 Schema 的 json 实例后,通过断言成
`FormSchema<TData, TCustomUIOptionMap>`
`TableSchema<TData, TCustomUIOptionMap>` 类型来使用。 在 json -> ts
的过程中无需校验,校验服务应由 schemas
的伺服器解决,保证取得的数据一定符合对应的格式

0 comments on commit 72af18b

Please sign in to comment.