Skip to content

Commit 59b4d36

Browse files
committed
Add toggle block schema
1 parent dd14dd3 commit 59b4d36

File tree

6 files changed

+323
-2
lines changed

6 files changed

+323
-2
lines changed

schema/block/block_schema.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
"quote",
2222
"equation",
2323
"table",
24-
"table_row"
24+
"table_row",
25+
"toggle"
2526
]
2627
}
2728
},
@@ -240,6 +241,18 @@
240241
"allOf": [{ "$ref": "/block/types/table_row/table_row_schema.json" }],
241242
"unevaluatedProperties": false
242243
}
244+
},
245+
{
246+
"if": {
247+
"properties": { "type": { "const": "toggle" } }
248+
},
249+
"then": {
250+
"properties": {
251+
"type": { "const": "toggle" }
252+
},
253+
"allOf": [{ "$ref": "/block/types/toggle/toggle_schema.json" }],
254+
"unevaluatedProperties": false
255+
}
243256
}
244257
// Add more conditions here for other block types
245258
]

schema/block/types/column_list/column_list_schema.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
// Column list can only have column blocks as children
1919
"$ref": "/block/types/column/column_schema.json"
2020
}
21-
}
21+
},
22+
"unevaluatedProperties": false
2223
},
2324
"required": ["type", "column_list"],
2425
"unevaluatedProperties": false
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
{
2+
"object": "block",
3+
"id": "e4c47a53-eea7-42cd-b51a-16fcbbaf5572",
4+
"parent": {
5+
"type": "block_id",
6+
"block_id": "8eb1b342-acf0-44be-b813-4f8348b385df"
7+
},
8+
"created_time": "2024-08-09T12:00:00.000Z",
9+
"last_edited_time": "2024-08-09T12:00:00.000Z",
10+
"created_by": {
11+
"object": "user",
12+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
13+
},
14+
"last_edited_by": {
15+
"object": "user",
16+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
17+
},
18+
"has_children": true,
19+
"archived": false,
20+
"in_trash": false,
21+
"type": "toggle",
22+
"toggle": {
23+
"rich_text": [
24+
{
25+
"type": "text",
26+
"text": {
27+
"content": "toggle",
28+
"link": null
29+
},
30+
"annotations": {
31+
"bold": false,
32+
"italic": false,
33+
"strikethrough": false,
34+
"underline": false,
35+
"code": false,
36+
"color": "default"
37+
},
38+
"plain_text": "toggle",
39+
"href": null
40+
}
41+
],
42+
"color": "default"
43+
},
44+
"children": [
45+
{
46+
"object": "block",
47+
"id": "f79d961f-7b00-464f-b3b2-a745041cea50",
48+
"parent": {
49+
"type": "block_id",
50+
"block_id": "e4c47a53-eea7-42cd-b51a-16fcbbaf5572"
51+
},
52+
"created_time": "2024-08-09T12:00:00.000Z",
53+
"last_edited_time": "2024-08-09T12:00:00.000Z",
54+
"created_by": {
55+
"object": "user",
56+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
57+
},
58+
"last_edited_by": {
59+
"object": "user",
60+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
61+
},
62+
"has_children": false,
63+
"archived": false,
64+
"in_trash": false,
65+
"type": "paragraph",
66+
"paragraph": {
67+
"rich_text": [
68+
{
69+
"type": "text",
70+
"text": {
71+
"content": "asdfasdfafd",
72+
"link": null
73+
},
74+
"annotations": {
75+
"bold": false,
76+
"italic": false,
77+
"strikethrough": false,
78+
"underline": false,
79+
"code": false,
80+
"color": "default"
81+
},
82+
"plain_text": "asdfasdfafd",
83+
"href": null
84+
}
85+
],
86+
"color": "default"
87+
}
88+
}
89+
]
90+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"invalid_key": 123,
3+
"object": "block",
4+
"id": "e4c47a53-eea7-42cd-b51a-16fcbbaf5572",
5+
"parent": {
6+
"type": "block_id",
7+
"block_id": "8eb1b342-acf0-44be-b813-4f8348b385df"
8+
},
9+
"created_time": "2024-08-09T12:00:00.000Z",
10+
"last_edited_time": "2024-08-09T12:00:00.000Z",
11+
"created_by": {
12+
"object": "user",
13+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
14+
},
15+
"last_edited_by": {
16+
"object": "user",
17+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
18+
},
19+
"has_children": true,
20+
"archived": false,
21+
"in_trash": false,
22+
"type": "toggle",
23+
"toggle": {
24+
"rich_text": [
25+
{
26+
"type": "text",
27+
"text": {
28+
"content": "toggle",
29+
"link": null
30+
},
31+
"annotations": {
32+
"bold": false,
33+
"italic": false,
34+
"strikethrough": false,
35+
"underline": false,
36+
"code": false,
37+
"color": "default"
38+
},
39+
"plain_text": "toggle",
40+
"href": null
41+
}
42+
],
43+
"color": "default"
44+
},
45+
"children": [
46+
{
47+
"object": "block",
48+
"id": "f79d961f-7b00-464f-b3b2-a745041cea50",
49+
"parent": {
50+
"type": "block_id",
51+
"block_id": "e4c47a53-eea7-42cd-b51a-16fcbbaf5572"
52+
},
53+
"created_time": "2024-08-09T12:00:00.000Z",
54+
"last_edited_time": "2024-08-09T12:00:00.000Z",
55+
"created_by": {
56+
"object": "user",
57+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
58+
},
59+
"last_edited_by": {
60+
"object": "user",
61+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
62+
},
63+
"has_children": false,
64+
"archived": false,
65+
"in_trash": false,
66+
"type": "paragraph",
67+
"paragraph": {
68+
"rich_text": [
69+
{
70+
"type": "text",
71+
"text": {
72+
"content": "asdfasdfafd",
73+
"link": null
74+
},
75+
"annotations": {
76+
"bold": false,
77+
"italic": false,
78+
"strikethrough": false,
79+
"underline": false,
80+
"code": false,
81+
"color": "default"
82+
},
83+
"plain_text": "asdfasdfafd",
84+
"href": null
85+
}
86+
],
87+
"color": "default"
88+
}
89+
}
90+
]
91+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "Toggle block",
4+
"type": "object",
5+
"allOf": [{ "$ref": "/block/common/common_schema.json" }],
6+
"properties": {
7+
"type": {
8+
"const": "toggle"
9+
},
10+
"toggle": {
11+
"type": "object",
12+
"properties": {
13+
"rich_text": {
14+
"type": "array",
15+
"items": {
16+
"$ref": "/block/types/rich_text/rich_text_schema.json"
17+
}
18+
},
19+
"color": {
20+
"$ref": "/shared_definitions.json#/$defs/color"
21+
}
22+
},
23+
"required": ["rich_text"],
24+
"unevaluatedProperties": false
25+
},
26+
"children": {
27+
"type": "array",
28+
"items": {
29+
"$ref": "/block/block_schema.json"
30+
}
31+
},
32+
"unevaluatedProperties": false
33+
},
34+
"required": ["type", "toggle"],
35+
"unevaluatedProperties": false
36+
}

schema/page/ex2_success.json

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3304,6 +3304,96 @@
33043304
"rich_text": [],
33053305
"color": "default"
33063306
}
3307+
},
3308+
{
3309+
"object": "block",
3310+
"id": "e4c47a53-eea7-42cd-b51a-16fcbbaf5572",
3311+
"parent": {
3312+
"type": "block_id",
3313+
"block_id": "8eb1b342-acf0-44be-b813-4f8348b385df"
3314+
},
3315+
"created_time": "2024-08-09T12:00:00.000Z",
3316+
"last_edited_time": "2024-08-09T12:00:00.000Z",
3317+
"created_by": {
3318+
"object": "user",
3319+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
3320+
},
3321+
"last_edited_by": {
3322+
"object": "user",
3323+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
3324+
},
3325+
"has_children": true,
3326+
"archived": false,
3327+
"in_trash": false,
3328+
"type": "toggle",
3329+
"toggle": {
3330+
"rich_text": [
3331+
{
3332+
"type": "text",
3333+
"text": {
3334+
"content": "toggle",
3335+
"link": null
3336+
},
3337+
"annotations": {
3338+
"bold": false,
3339+
"italic": false,
3340+
"strikethrough": false,
3341+
"underline": false,
3342+
"code": false,
3343+
"color": "default"
3344+
},
3345+
"plain_text": "toggle",
3346+
"href": null
3347+
}
3348+
],
3349+
"color": "default"
3350+
},
3351+
"children": [
3352+
{
3353+
"object": "block",
3354+
"id": "f79d961f-7b00-464f-b3b2-a745041cea50",
3355+
"parent": {
3356+
"type": "block_id",
3357+
"block_id": "e4c47a53-eea7-42cd-b51a-16fcbbaf5572"
3358+
},
3359+
"created_time": "2024-08-09T12:00:00.000Z",
3360+
"last_edited_time": "2024-08-09T12:00:00.000Z",
3361+
"created_by": {
3362+
"object": "user",
3363+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
3364+
},
3365+
"last_edited_by": {
3366+
"object": "user",
3367+
"id": "b9eb2a95-ab37-462d-b6ff-ff84080051f0"
3368+
},
3369+
"has_children": false,
3370+
"archived": false,
3371+
"in_trash": false,
3372+
"type": "paragraph",
3373+
"paragraph": {
3374+
"rich_text": [
3375+
{
3376+
"type": "text",
3377+
"text": {
3378+
"content": "asdfasdfafd",
3379+
"link": null
3380+
},
3381+
"annotations": {
3382+
"bold": false,
3383+
"italic": false,
3384+
"strikethrough": false,
3385+
"underline": false,
3386+
"code": false,
3387+
"color": "default"
3388+
},
3389+
"plain_text": "asdfasdfafd",
3390+
"href": null
3391+
}
3392+
],
3393+
"color": "default"
3394+
}
3395+
}
3396+
]
33073397
}
33083398
]
33093399
}

0 commit comments

Comments
 (0)