@plainbrew/microcms-api-schema-schema 0.0.1-alpha.0 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +59 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,9 +9,67 @@ microCMS の API スキーマを定義するためのスキーマライブラリ
|
|
|
9
9
|
## インストール
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
|
|
12
|
+
npm install -D @plainbrew/microcms-api-schema-schema
|
|
13
|
+
pnpm add -D @plainbrew/microcms-api-schema-schema
|
|
13
14
|
```
|
|
14
15
|
|
|
16
|
+
## 使い方
|
|
17
|
+
|
|
18
|
+
### JSON Schema としての利用
|
|
19
|
+
|
|
20
|
+
`$schema` プロパティで JSON Schema を参照することで、エディタの補完やバリデーションを有効にできます。
|
|
21
|
+
|
|
22
|
+
```json
|
|
23
|
+
{
|
|
24
|
+
"$schema": "./node_modules/@plainbrew/microcms-api-schema-schema/schema.json",
|
|
25
|
+
"apiFields": [
|
|
26
|
+
{
|
|
27
|
+
"fieldId": "title",
|
|
28
|
+
"name": "タイトル",
|
|
29
|
+
"kind": "text",
|
|
30
|
+
"required": true
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"fieldId": "body",
|
|
34
|
+
"name": "本文",
|
|
35
|
+
"kind": "richEditorV2",
|
|
36
|
+
"required": false
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"fieldId": "thumbnail",
|
|
40
|
+
"name": "サムネイル",
|
|
41
|
+
"kind": "media",
|
|
42
|
+
"required": true,
|
|
43
|
+
"imageSizeValidation": {
|
|
44
|
+
"imageSize": {
|
|
45
|
+
"width": 1200,
|
|
46
|
+
"height": 630
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
],
|
|
51
|
+
"customFields": []
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### サポートされるフィールドタイプ
|
|
56
|
+
|
|
57
|
+
| kind | 説明 |
|
|
58
|
+
| -------------- | ------------------ |
|
|
59
|
+
| `text` | テキストフィールド |
|
|
60
|
+
| `textArea` | テキストエリア |
|
|
61
|
+
| `richEditorV2` | リッチエディタ |
|
|
62
|
+
| `richEditor` | 旧リッチエディタ |
|
|
63
|
+
| `media` | 画像 |
|
|
64
|
+
| `mediaList` | 複数画像 |
|
|
65
|
+
| `date` | 日時 |
|
|
66
|
+
| `boolean` | 真偽値 |
|
|
67
|
+
| `select` | セレクトフィールド |
|
|
68
|
+
| `number` | 数字 |
|
|
69
|
+
| `relation` | コンテンツ参照 |
|
|
70
|
+
| `relationList` | 複数コンテンツ参照 |
|
|
71
|
+
| `iframe` | 拡張フィールド |
|
|
72
|
+
|
|
15
73
|
## 開発
|
|
16
74
|
|
|
17
75
|
```bash
|