Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 59 additions & 1 deletion packages/microcms-api-schema-schema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,67 @@ microCMS の API スキーマを定義するためのスキーマライブラリ
## インストール

```bash
pnpm add microcms-api-schema-schema
npm install -D @plainbrew/microcms-api-schema-schema
pnpm add -D @plainbrew/microcms-api-schema-schema
```

## 使い方

### JSON Schema としての利用

`$schema` プロパティで JSON Schema を参照することで、エディタの補完やバリデーションを有効にできます。

```json
{
"$schema": "./node_modules/@plainbrew/microcms-api-schema-schema/schema.json",
"apiFields": [
{
"fieldId": "title",
"name": "タイトル",
"kind": "text",
"required": true
},
{
"fieldId": "body",
"name": "本文",
"kind": "richEditorV2",
"required": false
},
{
"fieldId": "thumbnail",
"name": "サムネイル",
"kind": "media",
"required": true,
"imageSizeValidation": {
"imageSize": {
"width": 1200,
"height": 630
}
}
}
],
"customFields": []
}
```

### サポートされるフィールドタイプ

| kind | 説明 |
| -------------- | ------------------ |
| `text` | テキストフィールド |
| `textArea` | テキストエリア |
| `richEditorV2` | リッチエディタ |
| `richEditor` | 旧リッチエディタ |
| `media` | 画像 |
| `mediaList` | 複数画像 |
| `date` | 日時 |
| `boolean` | 真偽値 |
| `select` | セレクトフィールド |
| `number` | 数字 |
| `relation` | コンテンツ参照 |
| `relationList` | 複数コンテンツ参照 |
| `iframe` | 拡張フィールド |

## 開発

```bash
Expand Down
2 changes: 1 addition & 1 deletion packages/microcms-api-schema-schema/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@plainbrew/microcms-api-schema-schema",
"version": "0.0.1-alpha.0",
"version": "0.0.1",
"description": "",
"license": "MIT",
"files": [
Expand Down