Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 22, 14:30 UTC
fix(ts/cli): fix generateTypeFromJsonSchema, allowing $def in input/output schemas
jkomyno committed
Jan 14, 2026 at 21:06 UTC
354c007fb9954527364295c53ea88579b0d8377d
7 files changed
+4270
-1
ts/packages/cli/src/generation/typescript/generate-type-from-json-schema.ts
+34
-1
@@ -12,13 +12,19 @@ export function generateTypeFromJsonSchema(
12
name: string,
13
schema: { readonly [x: string]: unknown }
14
) {
15
+ // Preprocess the schema to remove discriminator objects that reference non-existent $defs.
16
+ // The Composio API returns schemas with discriminator.mapping that point to #/$defs/... paths,
17
+ // but the actual types are inlined in oneOf/anyOf arrays. openapi-typescript can handle
18
+ // oneOf/anyOf without discriminator, so we simply remove it.
19
+ const processedProperties = removeDiscriminators(schema['properties']);
20
+
21
const openApi3Definition = {
22
openapi: '3.1.0',
23
components: {
24
schemas: {
25
[name]: {
26
type: 'object',
21
- properties: schema['properties'],
27
+ properties: processedProperties,
28
},
29
},
30
},
@@ -140,3 +146,30 @@ export function generateTypeFromJsonSchema(
146
function isInterfaceComponents(node: ts.Node): node is ts.InterfaceDeclaration {
147
return ts.isInterfaceDeclaration(node) && node.name.escapedText === 'components';
148
}
149
+
150
+/**
151
+ * Recursively removes `discriminator` objects from a JSON schema.
152
+ * This is needed because Composio's API returns schemas with discriminator.mapping
153
+ * that reference #/$defs/... paths, but the types are inlined in oneOf/anyOf arrays
154
+ * rather than defined in a $defs section. openapi-typescript fails to resolve these refs.
155
+ * Since oneOf/anyOf work fine without discriminator, we simply remove it.
156
+ */
157
+function removeDiscriminators(obj: unknown): unknown {
158
+ if (obj === null || typeof obj !== 'object') {
159
+ return obj;
160
+ }
161
+
162
+ if (Array.isArray(obj)) {
163
+ return obj.map(removeDiscriminators);
164
+ }
165
+
166
+ const result: Record<string, unknown> = {};
167
+ for (const [key, value] of Object.entries(obj)) {
168
+ if (key === 'discriminator') {
169
+ // Skip discriminator objects entirely
170
+ continue;
171
+ }
172
+ result[key] = removeDiscriminators(value);
173
+ }
174
+ return result;
175
+}
ts/packages/cli/test/__fixtures__/notion-append-text-blocks.json
new
+1563
@@ -0,0 +1,1563 @@
1
+{
2
+ "slug": "NOTION_APPEND_TEXT_BLOCKS",
3
+ "name": "Append text blocks (paragraphs, headings, lists)",
4
+ "description": "Append text blocks (paragraphs, headings, lists) to a Notion page. This is the most commonly used action for adding content to Notion. Use for: documentation, notes, articles, outlines, lists. Supported block types: - paragraph: Regular text - heading_1, heading_2, heading_3: Section headers - bulleted_list_item: Bullet points - numbered_list_item: Numbered lists ⚠️ Text content is limited to 2000 characters per text.content field. For other block types, use specialized actions: - append_task_blocks: to-do, toggle, callout - append_code_blocks: code, quote, equation - append_media_blocks: image, video, audio, files - append_layout_blocks: divider, columns, TOC - append_table_blocks: tables",
5
+ "available_versions": ["20260113_00"],
6
+ "version": "20260113_00",
7
+ "toolkit": {
8
+ "slug": "notion",
9
+ "name": "notion",
10
+ "logo": "https://logos.composio.dev/api/notion"
11
+ },
12
+ "input_parameters": {
13
+ "description": "Request model for appending text blocks to a Notion page.",
14
+ "properties": {
15
+ "after": {
16
+ "anyOf": [
17
+ {
18
+ "type": "string"
19
+ },
20
+ {
21
+ "type": "null"
22
+ }
23
+ ],
24
+ "default": null,
25
+ "description": "Optional UUID of an existing child block. New blocks will be inserted after this block.",
26
+ "examples": ["9bc30ad4-9373-46a5-84ab-0a7845ee52e6"],
27
+ "title": "After"
28
+ },
29
+ "block_id": {
30
+ "description": "The UUID of the parent block or page to append children to.",
31
+ "examples": ["b55c9c91-384d-452b-81db-d1ef79372b75", "b55c9c91384d452b81dbd1ef79372b75"],
32
+ "title": "Block Id",
33
+ "type": "string"
34
+ },
35
+ "children": {
36
+ "description": "Array of text block objects to append (also accepts 'blocks' as parameter name). Supported types:\n- paragraph: Regular text paragraph\n- heading_1, heading_2, heading_3: Section headings\n- bulleted_list_item: Bullet point\n- numbered_list_item: Numbered list item\n\n⚠️ Text content limited to 2000 characters per rich_text text.content field.\nMax 100 blocks per request.",
37
+ "examples": [
38
+ [
39
+ {
40
+ "heading_2": {
41
+ "rich_text": [
42
+ {
43
+ "text": {
44
+ "content": "Section Title"
45
+ },
46
+ "type": "text"
47
+ }
48
+ ]
49
+ },
50
+ "object": "block",
51
+ "type": "heading_2"
52
+ }
53
+ ],
54
+ [
55
+ {
56
+ "object": "block",
57
+ "paragraph": {
58
+ "rich_text": [
59
+ {
60
+ "text": {
61
+ "content": "This is a paragraph."
62
+ },
63
+ "type": "text"
64
+ }
65
+ ]
66
+ },
67
+ "type": "paragraph"
68
+ }
69
+ ]
70
+ ],
71
+ "items": {
72
+ "discriminator": {
73
+ "mapping": {
74
+ "bulleted_list_item": "#/$defs/BulletedListItemBlockInput",
75
+ "heading_1": "#/$defs/Heading1BlockInput",
76
+ "heading_2": "#/$defs/Heading2BlockInput",
77
+ "heading_3": "#/$defs/Heading3BlockInput",
78
+ "numbered_list_item": "#/$defs/NumberedListItemBlockInput",
79
+ "paragraph": "#/$defs/ParagraphBlockInput"
80
+ },
81
+ "propertyName": "type"
82
+ },
83
+ "oneOf": [
84
+ {
85
+ "description": "A paragraph block object.",
86
+ "properties": {
87
+ "object": {
88
+ "const": "block",
89
+ "default": "block",
90
+ "description": "Always 'block'.",
91
+ "title": "Object",
92
+ "type": "string"
93
+ },
94
+ "paragraph": {
95
+ "description": "Paragraph content.",
96
+ "properties": {
97
+ "color": {
98
+ "default": "default",
99
+ "description": "Color of the paragraph text or background.",
100
+ "enum": [
101
+ "default",
102
+ "gray",
103
+ "brown",
104
+ "orange",
105
+ "yellow",
106
+ "green",
107
+ "blue",
108
+ "purple",
109
+ "pink",
110
+ "red",
111
+ "gray_background",
112
+ "brown_background",
113
+ "orange_background",
114
+ "yellow_background",
115
+ "green_background",
116
+ "blue_background",
117
+ "purple_background",
118
+ "pink_background",
119
+ "red_background"
120
+ ],
121
+ "title": "BlockColor",
122
+ "type": "string"
123
+ },
124
+ "rich_text": {
125
+ "description": "Array of rich text objects. Each text.content is limited to 2000 chars.",
126
+ "items": {
127
+ "description": "Rich text object for creating text content in blocks.",
128
+ "properties": {
129
+ "annotations": {
130
+ "anyOf": [
131
+ {
132
+ "description": "Text styling annotations for rich text.",
133
+ "properties": {
134
+ "bold": {
135
+ "default": false,
136
+ "description": "Whether the text is bold.",
137
+ "title": "Bold",
138
+ "type": "boolean"
139
+ },
140
+ "code": {
141
+ "default": false,
142
+ "description": "Whether the text is formatted as inline code.",
143
+ "title": "Code",
144
+ "type": "boolean"
145
+ },
146
+ "color": {
147
+ "default": "default",
148
+ "description": "Color of the text or background.",
149
+ "enum": [
150
+ "default",
151
+ "gray",
152
+ "brown",
153
+ "orange",
154
+ "yellow",
155
+ "green",
156
+ "blue",
157
+ "purple",
158
+ "pink",
159
+ "red",
160
+ "gray_background",
161
+ "brown_background",
162
+ "orange_background",
163
+ "yellow_background",
164
+ "green_background",
165
+ "blue_background",
166
+ "purple_background",
167
+ "pink_background",
168
+ "red_background"
169
+ ],
170
+ "title": "BlockColor",
171
+ "type": "string"
172
+ },
173
+ "italic": {
174
+ "default": false,
175
+ "description": "Whether the text is italic.",
176
+ "title": "Italic",
177
+ "type": "boolean"
178
+ },
179
+ "strikethrough": {
180
+ "default": false,
181
+ "description": "Whether the text has strikethrough.",
182
+ "title": "Strikethrough",
183
+ "type": "boolean"
184
+ },
185
+ "underline": {
186
+ "default": false,
187
+ "description": "Whether the text is underlined.",
188
+ "title": "Underline",
189
+ "type": "boolean"
190
+ }
191
+ },
192
+ "title": "TextAnnotations",
193
+ "type": "object"
194
+ },
195
+ {
196
+ "type": "null"
197
+ }
198
+ ],
199
+ "default": null,
200
+ "description": "Optional text styling annotations (bold, italic, etc.)."
201
+ },
202
+ "text": {
203
+ "description": "The text content object.",
204
+ "properties": {
205
+ "content": {
206
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
207
+ "examples": ["Hello, World!", "This is a paragraph of text."],
208
+ "maxLength": 2000,
209
+ "title": "Content",
210
+ "type": "string"
211
+ },
212
+ "link": {
213
+ "anyOf": [
214
+ {
215
+ "description": "Link object for hyperlinked text.",
216
+ "properties": {
217
+ "url": {
218
+ "description": "The URL the text links to.",
219
+ "examples": [
220
+ "https://www.notion.so",
221
+ "https://example.com"
222
+ ],
223
+ "title": "Url",
224
+ "type": "string"
225
+ }
226
+ },
227
+ "required": ["url"],
228
+ "title": "TextLink",
229
+ "type": "object"
230
+ },
231
+ {
232
+ "type": "null"
233
+ }
234
+ ],
235
+ "default": null,
236
+ "description": "Optional link for the text."
237
+ }
238
+ },
239
+ "required": ["content"],
240
+ "title": "TextContent",
241
+ "type": "object"
242
+ },
243
+ "type": {
244
+ "const": "text",
245
+ "default": "text",
246
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
247
+ "title": "Type",
248
+ "type": "string"
249
+ }
250
+ },
251
+ "required": ["text"],
252
+ "title": "RichTextInput",
253
+ "type": "object"
254
+ },
255
+ "minItems": 1,
256
+ "title": "Rich Text",
257
+ "type": "array"
258
+ }
259
+ },
260
+ "required": ["rich_text"],
261
+ "title": "ParagraphInput",
262
+ "type": "object"
263
+ },
264
+ "type": {
265
+ "const": "paragraph",
266
+ "default": "paragraph",
267
+ "description": "Block type.",
268
+ "title": "Type",
269
+ "type": "string"
270
+ }
271
+ },
272
+ "required": ["paragraph"],
273
+ "title": "ParagraphBlockInput",
274
+ "type": "object"
275
+ },
276
+ {
277
+ "description": "A heading 1 block object (largest heading).",
278
+ "properties": {
279
+ "heading_1": {
280
+ "description": "Heading 1 content.",
281
+ "properties": {
282
+ "color": {
283
+ "default": "default",
284
+ "description": "Color of the heading.",
285
+ "enum": [
286
+ "default",
287
+ "gray",
288
+ "brown",
289
+ "orange",
290
+ "yellow",
291
+ "green",
292
+ "blue",
293
+ "purple",
294
+ "pink",
295
+ "red",
296
+ "gray_background",
297
+ "brown_background",
298
+ "orange_background",
299
+ "yellow_background",
300
+ "green_background",
301
+ "blue_background",
302
+ "purple_background",
303
+ "pink_background",
304
+ "red_background"
305
+ ],
306
+ "title": "BlockColor",
307
+ "type": "string"
308
+ },
309
+ "is_toggleable": {
310
+ "default": false,
311
+ "description": "Whether the heading can be toggled to show/hide content.",
312
+ "title": "Is Toggleable",
313
+ "type": "boolean"
314
+ },
315
+ "rich_text": {
316
+ "description": "Array of rich text objects for the heading text.",
317
+ "items": {
318
+ "description": "Rich text object for creating text content in blocks.",
319
+ "properties": {
320
+ "annotations": {
321
+ "anyOf": [
322
+ {
323
+ "description": "Text styling annotations for rich text.",
324
+ "properties": {
325
+ "bold": {
326
+ "default": false,
327
+ "description": "Whether the text is bold.",
328
+ "title": "Bold",
329
+ "type": "boolean"
330
+ },
331
+ "code": {
332
+ "default": false,
333
+ "description": "Whether the text is formatted as inline code.",
334
+ "title": "Code",
335
+ "type": "boolean"
336
+ },
337
+ "color": {
338
+ "default": "default",
339
+ "description": "Color of the text or background.",
340
+ "enum": [
341
+ "default",
342
+ "gray",
343
+ "brown",
344
+ "orange",
345
+ "yellow",
346
+ "green",
347
+ "blue",
348
+ "purple",
349
+ "pink",
350
+ "red",
351
+ "gray_background",
352
+ "brown_background",
353
+ "orange_background",
354
+ "yellow_background",
355
+ "green_background",
356
+ "blue_background",
357
+ "purple_background",
358
+ "pink_background",
359
+ "red_background"
360
+ ],
361
+ "title": "BlockColor",
362
+ "type": "string"
363
+ },
364
+ "italic": {
365
+ "default": false,
366
+ "description": "Whether the text is italic.",
367
+ "title": "Italic",
368
+ "type": "boolean"
369
+ },
370
+ "strikethrough": {
371
+ "default": false,
372
+ "description": "Whether the text has strikethrough.",
373
+ "title": "Strikethrough",
374
+ "type": "boolean"
375
+ },
376
+ "underline": {
377
+ "default": false,
378
+ "description": "Whether the text is underlined.",
379
+ "title": "Underline",
380
+ "type": "boolean"
381
+ }
382
+ },
383
+ "title": "TextAnnotations",
384
+ "type": "object"
385
+ },
386
+ {
387
+ "type": "null"
388
+ }
389
+ ],
390
+ "default": null,
391
+ "description": "Optional text styling annotations (bold, italic, etc.)."
392
+ },
393
+ "text": {
394
+ "description": "The text content object.",
395
+ "properties": {
396
+ "content": {
397
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
398
+ "examples": ["Hello, World!", "This is a paragraph of text."],
399
+ "maxLength": 2000,
400
+ "title": "Content",
401
+ "type": "string"
402
+ },
403
+ "link": {
404
+ "anyOf": [
405
+ {
406
+ "description": "Link object for hyperlinked text.",
407
+ "properties": {
408
+ "url": {
409
+ "description": "The URL the text links to.",
410
+ "examples": [
411
+ "https://www.notion.so",
412
+ "https://example.com"
413
+ ],
414
+ "title": "Url",
415
+ "type": "string"
416
+ }
417
+ },
418
+ "required": ["url"],
419
+ "title": "TextLink",
420
+ "type": "object"
421
+ },
422
+ {
423
+ "type": "null"
424
+ }
425
+ ],
426
+ "default": null,
427
+ "description": "Optional link for the text."
428
+ }
429
+ },
430
+ "required": ["content"],
431
+ "title": "TextContent",
432
+ "type": "object"
433
+ },
434
+ "type": {
435
+ "const": "text",
436
+ "default": "text",
437
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
438
+ "title": "Type",
439
+ "type": "string"
440
+ }
441
+ },
442
+ "required": ["text"],
443
+ "title": "RichTextInput",
444
+ "type": "object"
445
+ },
446
+ "minItems": 1,
447
+ "title": "Rich Text",
448
+ "type": "array"
449
+ }
450
+ },
451
+ "required": ["rich_text"],
452
+ "title": "HeadingInput",
453
+ "type": "object"
454
+ },
455
+ "object": {
456
+ "const": "block",
457
+ "default": "block",
458
+ "description": "Always 'block'.",
459
+ "title": "Object",
460
+ "type": "string"
461
+ },
462
+ "type": {
463
+ "const": "heading_1",
464
+ "default": "heading_1",
465
+ "description": "Block type.",
466
+ "title": "Type",
467
+ "type": "string"
468
+ }
469
+ },
470
+ "required": ["heading_1"],
471
+ "title": "Heading1BlockInput",
472
+ "type": "object"
473
+ },
474
+ {
475
+ "description": "A heading 2 block object (medium heading).",
476
+ "properties": {
477
+ "heading_2": {
478
+ "description": "Heading 2 content.",
479
+ "properties": {
480
+ "color": {
481
+ "default": "default",
482
+ "description": "Color of the heading.",
483
+ "enum": [
484
+ "default",
485
+ "gray",
486
+ "brown",
487
+ "orange",
488
+ "yellow",
489
+ "green",
490
+ "blue",
491
+ "purple",
492
+ "pink",
493
+ "red",
494
+ "gray_background",
495
+ "brown_background",
496
+ "orange_background",
497
+ "yellow_background",
498
+ "green_background",
499
+ "blue_background",
500
+ "purple_background",
501
+ "pink_background",
502
+ "red_background"
503
+ ],
504
+ "title": "BlockColor",
505
+ "type": "string"
506
+ },
507
+ "is_toggleable": {
508
+ "default": false,
509
+ "description": "Whether the heading can be toggled to show/hide content.",
510
+ "title": "Is Toggleable",
511
+ "type": "boolean"
512
+ },
513
+ "rich_text": {
514
+ "description": "Array of rich text objects for the heading text.",
515
+ "items": {
516
+ "description": "Rich text object for creating text content in blocks.",
517
+ "properties": {
518
+ "annotations": {
519
+ "anyOf": [
520
+ {
521
+ "description": "Text styling annotations for rich text.",
522
+ "properties": {
523
+ "bold": {
524
+ "default": false,
525
+ "description": "Whether the text is bold.",
526
+ "title": "Bold",
527
+ "type": "boolean"
528
+ },
529
+ "code": {
530
+ "default": false,
531
+ "description": "Whether the text is formatted as inline code.",
532
+ "title": "Code",
533
+ "type": "boolean"
534
+ },
535
+ "color": {
536
+ "default": "default",
537
+ "description": "Color of the text or background.",
538
+ "enum": [
539
+ "default",
540
+ "gray",
541
+ "brown",
542
+ "orange",
543
+ "yellow",
544
+ "green",
545
+ "blue",
546
+ "purple",
547
+ "pink",
548
+ "red",
549
+ "gray_background",
550
+ "brown_background",
551
+ "orange_background",
552
+ "yellow_background",
553
+ "green_background",
554
+ "blue_background",
555
+ "purple_background",
556
+ "pink_background",
557
+ "red_background"
558
+ ],
559
+ "title": "BlockColor",
560
+ "type": "string"
561
+ },
562
+ "italic": {
563
+ "default": false,
564
+ "description": "Whether the text is italic.",
565
+ "title": "Italic",
566
+ "type": "boolean"
567
+ },
568
+ "strikethrough": {
569
+ "default": false,
570
+ "description": "Whether the text has strikethrough.",
571
+ "title": "Strikethrough",
572
+ "type": "boolean"
573
+ },
574
+ "underline": {
575
+ "default": false,
576
+ "description": "Whether the text is underlined.",
577
+ "title": "Underline",
578
+ "type": "boolean"
579
+ }
580
+ },
581
+ "title": "TextAnnotations",
582
+ "type": "object"
583
+ },
584
+ {
585
+ "type": "null"
586
+ }
587
+ ],
588
+ "default": null,
589
+ "description": "Optional text styling annotations (bold, italic, etc.)."
590
+ },
591
+ "text": {
592
+ "description": "The text content object.",
593
+ "properties": {
594
+ "content": {
595
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
596
+ "examples": ["Hello, World!", "This is a paragraph of text."],
597
+ "maxLength": 2000,
598
+ "title": "Content",
599
+ "type": "string"
600
+ },
601
+ "link": {
602
+ "anyOf": [
603
+ {
604
+ "description": "Link object for hyperlinked text.",
605
+ "properties": {
606
+ "url": {
607
+ "description": "The URL the text links to.",
608
+ "examples": [
609
+ "https://www.notion.so",
610
+ "https://example.com"
611
+ ],
612
+ "title": "Url",
613
+ "type": "string"
614
+ }
615
+ },
616
+ "required": ["url"],
617
+ "title": "TextLink",
618
+ "type": "object"
619
+ },
620
+ {
621
+ "type": "null"
622
+ }
623
+ ],
624
+ "default": null,
625
+ "description": "Optional link for the text."
626
+ }
627
+ },
628
+ "required": ["content"],
629
+ "title": "TextContent",
630
+ "type": "object"
631
+ },
632
+ "type": {
633
+ "const": "text",
634
+ "default": "text",
635
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
636
+ "title": "Type",
637
+ "type": "string"
638
+ }
639
+ },
640
+ "required": ["text"],
641
+ "title": "RichTextInput",
642
+ "type": "object"
643
+ },
644
+ "minItems": 1,
645
+ "title": "Rich Text",
646
+ "type": "array"
647
+ }
648
+ },
649
+ "required": ["rich_text"],
650
+ "title": "HeadingInput",
651
+ "type": "object"
652
+ },
653
+ "object": {
654
+ "const": "block",
655
+ "default": "block",
656
+ "description": "Always 'block'.",
657
+ "title": "Object",
658
+ "type": "string"
659
+ },
660
+ "type": {
661
+ "const": "heading_2",
662
+ "default": "heading_2",
663
+ "description": "Block type.",
664
+ "title": "Type",
665
+ "type": "string"
666
+ }
667
+ },
668
+ "required": ["heading_2"],
669
+ "title": "Heading2BlockInput",
670
+ "type": "object"
671
+ },
672
+ {
673
+ "description": "A heading 3 block object (smallest heading).",
674
+ "properties": {
675
+ "heading_3": {
676
+ "description": "Heading 3 content.",
677
+ "properties": {
678
+ "color": {
679
+ "default": "default",
680
+ "description": "Color of the heading.",
681
+ "enum": [
682
+ "default",
683
+ "gray",
684
+ "brown",
685
+ "orange",
686
+ "yellow",
687
+ "green",
688
+ "blue",
689
+ "purple",
690
+ "pink",
691
+ "red",
692
+ "gray_background",
693
+ "brown_background",
694
+ "orange_background",
695
+ "yellow_background",
696
+ "green_background",
697
+ "blue_background",
698
+ "purple_background",
699
+ "pink_background",
700
+ "red_background"
701
+ ],
702
+ "title": "BlockColor",
703
+ "type": "string"
704
+ },
705
+ "is_toggleable": {
706
+ "default": false,
707
+ "description": "Whether the heading can be toggled to show/hide content.",
708
+ "title": "Is Toggleable",
709
+ "type": "boolean"
710
+ },
711
+ "rich_text": {
712
+ "description": "Array of rich text objects for the heading text.",
713
+ "items": {
714
+ "description": "Rich text object for creating text content in blocks.",
715
+ "properties": {
716
+ "annotations": {
717
+ "anyOf": [
718
+ {
719
+ "description": "Text styling annotations for rich text.",
720
+ "properties": {
721
+ "bold": {
722
+ "default": false,
723
+ "description": "Whether the text is bold.",
724
+ "title": "Bold",
725
+ "type": "boolean"
726
+ },
727
+ "code": {
728
+ "default": false,
729
+ "description": "Whether the text is formatted as inline code.",
730
+ "title": "Code",
731
+ "type": "boolean"
732
+ },
733
+ "color": {
734
+ "default": "default",
735
+ "description": "Color of the text or background.",
736
+ "enum": [
737
+ "default",
738
+ "gray",
739
+ "brown",
740
+ "orange",
741
+ "yellow",
742
+ "green",
743
+ "blue",
744
+ "purple",
745
+ "pink",
746
+ "red",
747
+ "gray_background",
748
+ "brown_background",
749
+ "orange_background",
750
+ "yellow_background",
751
+ "green_background",
752
+ "blue_background",
753
+ "purple_background",
754
+ "pink_background",
755
+ "red_background"
756
+ ],
757
+ "title": "BlockColor",
758
+ "type": "string"
759
+ },
760
+ "italic": {
761
+ "default": false,
762
+ "description": "Whether the text is italic.",
763
+ "title": "Italic",
764
+ "type": "boolean"
765
+ },
766
+ "strikethrough": {
767
+ "default": false,
768
+ "description": "Whether the text has strikethrough.",
769
+ "title": "Strikethrough",
770
+ "type": "boolean"
771
+ },
772
+ "underline": {
773
+ "default": false,
774
+ "description": "Whether the text is underlined.",
775
+ "title": "Underline",
776
+ "type": "boolean"
777
+ }
778
+ },
779
+ "title": "TextAnnotations",
780
+ "type": "object"
781
+ },
782
+ {
783
+ "type": "null"
784
+ }
785
+ ],
786
+ "default": null,
787
+ "description": "Optional text styling annotations (bold, italic, etc.)."
788
+ },
789
+ "text": {
790
+ "description": "The text content object.",
791
+ "properties": {
792
+ "content": {
793
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
794
+ "examples": ["Hello, World!", "This is a paragraph of text."],
795
+ "maxLength": 2000,
796
+ "title": "Content",
797
+ "type": "string"
798
+ },
799
+ "link": {
800
+ "anyOf": [
801
+ {
802
+ "description": "Link object for hyperlinked text.",
803
+ "properties": {
804
+ "url": {
805
+ "description": "The URL the text links to.",
806
+ "examples": [
807
+ "https://www.notion.so",
808
+ "https://example.com"
809
+ ],
810
+ "title": "Url",
811
+ "type": "string"
812
+ }
813
+ },
814
+ "required": ["url"],
815
+ "title": "TextLink",
816
+ "type": "object"
817
+ },
818
+ {
819
+ "type": "null"
820
+ }
821
+ ],
822
+ "default": null,
823
+ "description": "Optional link for the text."
824
+ }
825
+ },
826
+ "required": ["content"],
827
+ "title": "TextContent",
828
+ "type": "object"
829
+ },
830
+ "type": {
831
+ "const": "text",
832
+ "default": "text",
833
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
834
+ "title": "Type",
835
+ "type": "string"
836
+ }
837
+ },
838
+ "required": ["text"],
839
+ "title": "RichTextInput",
840
+ "type": "object"
841
+ },
842
+ "minItems": 1,
843
+ "title": "Rich Text",
844
+ "type": "array"
845
+ }
846
+ },
847
+ "required": ["rich_text"],
848
+ "title": "HeadingInput",
849
+ "type": "object"
850
+ },
851
+ "object": {
852
+ "const": "block",
853
+ "default": "block",
854
+ "description": "Always 'block'.",
855
+ "title": "Object",
856
+ "type": "string"
857
+ },
858
+ "type": {
859
+ "const": "heading_3",
860
+ "default": "heading_3",
861
+ "description": "Block type.",
862
+ "title": "Type",
863
+ "type": "string"
864
+ }
865
+ },
866
+ "required": ["heading_3"],
867
+ "title": "Heading3BlockInput",
868
+ "type": "object"
869
+ },
870
+ {
871
+ "description": "A bulleted list item block object.",
872
+ "properties": {
873
+ "bulleted_list_item": {
874
+ "description": "Bulleted list item content.",
875
+ "properties": {
876
+ "color": {
877
+ "default": "default",
878
+ "description": "Color of the list item.",
879
+ "enum": [
880
+ "default",
881
+ "gray",
882
+ "brown",
883
+ "orange",
884
+ "yellow",
885
+ "green",
886
+ "blue",
887
+ "purple",
888
+ "pink",
889
+ "red",
890
+ "gray_background",
891
+ "brown_background",
892
+ "orange_background",
893
+ "yellow_background",
894
+ "green_background",
895
+ "blue_background",
896
+ "purple_background",
897
+ "pink_background",
898
+ "red_background"
899
+ ],
900
+ "title": "BlockColor",
901
+ "type": "string"
902
+ },
903
+ "rich_text": {
904
+ "description": "Array of rich text objects for the list item text.",
905
+ "items": {
906
+ "description": "Rich text object for creating text content in blocks.",
907
+ "properties": {
908
+ "annotations": {
909
+ "anyOf": [
910
+ {
911
+ "description": "Text styling annotations for rich text.",
912
+ "properties": {
913
+ "bold": {
914
+ "default": false,
915
+ "description": "Whether the text is bold.",
916
+ "title": "Bold",
917
+ "type": "boolean"
918
+ },
919
+ "code": {
920
+ "default": false,
921
+ "description": "Whether the text is formatted as inline code.",
922
+ "title": "Code",
923
+ "type": "boolean"
924
+ },
925
+ "color": {
926
+ "default": "default",
927
+ "description": "Color of the text or background.",
928
+ "enum": [
929
+ "default",
930
+ "gray",
931
+ "brown",
932
+ "orange",
933
+ "yellow",
934
+ "green",
935
+ "blue",
936
+ "purple",
937
+ "pink",
938
+ "red",
939
+ "gray_background",
940
+ "brown_background",
941
+ "orange_background",
942
+ "yellow_background",
943
+ "green_background",
944
+ "blue_background",
945
+ "purple_background",
946
+ "pink_background",
947
+ "red_background"
948
+ ],
949
+ "title": "BlockColor",
950
+ "type": "string"
951
+ },
952
+ "italic": {
953
+ "default": false,
954
+ "description": "Whether the text is italic.",
955
+ "title": "Italic",
956
+ "type": "boolean"
957
+ },
958
+ "strikethrough": {
959
+ "default": false,
960
+ "description": "Whether the text has strikethrough.",
961
+ "title": "Strikethrough",
962
+ "type": "boolean"
963
+ },
964
+ "underline": {
965
+ "default": false,
966
+ "description": "Whether the text is underlined.",
967
+ "title": "Underline",
968
+ "type": "boolean"
969
+ }
970
+ },
971
+ "title": "TextAnnotations",
972
+ "type": "object"
973
+ },
974
+ {
975
+ "type": "null"
976
+ }
977
+ ],
978
+ "default": null,
979
+ "description": "Optional text styling annotations (bold, italic, etc.)."
980
+ },
981
+ "text": {
982
+ "description": "The text content object.",
983
+ "properties": {
984
+ "content": {
985
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
986
+ "examples": ["Hello, World!", "This is a paragraph of text."],
987
+ "maxLength": 2000,
988
+ "title": "Content",
989
+ "type": "string"
990
+ },
991
+ "link": {
992
+ "anyOf": [
993
+ {
994
+ "description": "Link object for hyperlinked text.",
995
+ "properties": {
996
+ "url": {
997
+ "description": "The URL the text links to.",
998
+ "examples": [
999
+ "https://www.notion.so",
1000
+ "https://example.com"
1001
+ ],
1002
+ "title": "Url",
1003
+ "type": "string"
1004
+ }
1005
+ },
1006
+ "required": ["url"],
1007
+ "title": "TextLink",
1008
+ "type": "object"
1009
+ },
1010
+ {
1011
+ "type": "null"
1012
+ }
1013
+ ],
1014
+ "default": null,
1015
+ "description": "Optional link for the text."
1016
+ }
1017
+ },
1018
+ "required": ["content"],
1019
+ "title": "TextContent",
1020
+ "type": "object"
1021
+ },
1022
+ "type": {
1023
+ "const": "text",
1024
+ "default": "text",
1025
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
1026
+ "title": "Type",
1027
+ "type": "string"
1028
+ }
1029
+ },
1030
+ "required": ["text"],
1031
+ "title": "RichTextInput",
1032
+ "type": "object"
1033
+ },
1034
+ "minItems": 1,
1035
+ "title": "Rich Text",
1036
+ "type": "array"
1037
+ }
1038
+ },
1039
+ "required": ["rich_text"],
1040
+ "title": "ListItemInput",
1041
+ "type": "object"
1042
+ },
1043
+ "object": {
1044
+ "const": "block",
1045
+ "default": "block",
1046
+ "description": "Always 'block'.",
1047
+ "title": "Object",
1048
+ "type": "string"
1049
+ },
1050
+ "type": {
1051
+ "const": "bulleted_list_item",
1052
+ "default": "bulleted_list_item",
1053
+ "description": "Block type.",
1054
+ "title": "Type",
1055
+ "type": "string"
1056
+ }
1057
+ },
1058
+ "required": ["bulleted_list_item"],
1059
+ "title": "BulletedListItemBlockInput",
1060
+ "type": "object"
1061
+ },
1062
+ {
1063
+ "description": "A numbered list item block object.",
1064
+ "properties": {
1065
+ "numbered_list_item": {
1066
+ "description": "Numbered list item content.",
1067
+ "properties": {
1068
+ "color": {
1069
+ "default": "default",
1070
+ "description": "Color of the list item.",
1071
+ "enum": [
1072
+ "default",
1073
+ "gray",
1074
+ "brown",
1075
+ "orange",
1076
+ "yellow",
1077
+ "green",
1078
+ "blue",
1079
+ "purple",
1080
+ "pink",
1081
+ "red",
1082
+ "gray_background",
1083
+ "brown_background",
1084
+ "orange_background",
1085
+ "yellow_background",
1086
+ "green_background",
1087
+ "blue_background",
1088
+ "purple_background",
1089
+ "pink_background",
1090
+ "red_background"
1091
+ ],
1092
+ "title": "BlockColor",
1093
+ "type": "string"
1094
+ },
1095
+ "rich_text": {
1096
+ "description": "Array of rich text objects for the list item text.",
1097
+ "items": {
1098
+ "description": "Rich text object for creating text content in blocks.",
1099
+ "properties": {
1100
+ "annotations": {
1101
+ "anyOf": [
1102
+ {
1103
+ "description": "Text styling annotations for rich text.",
1104
+ "properties": {
1105
+ "bold": {
1106
+ "default": false,
1107
+ "description": "Whether the text is bold.",
1108
+ "title": "Bold",
1109
+ "type": "boolean"
1110
+ },
1111
+ "code": {
1112
+ "default": false,
1113
+ "description": "Whether the text is formatted as inline code.",
1114
+ "title": "Code",
1115
+ "type": "boolean"
1116
+ },
1117
+ "color": {
1118
+ "default": "default",
1119
+ "description": "Color of the text or background.",
1120
+ "enum": [
1121
+ "default",
1122
+ "gray",
1123
+ "brown",
1124
+ "orange",
1125
+ "yellow",
1126
+ "green",
1127
+ "blue",
1128
+ "purple",
1129
+ "pink",
1130
+ "red",
1131
+ "gray_background",
1132
+ "brown_background",
1133
+ "orange_background",
1134
+ "yellow_background",
1135
+ "green_background",
1136
+ "blue_background",
1137
+ "purple_background",
1138
+ "pink_background",
1139
+ "red_background"
1140
+ ],
1141
+ "title": "BlockColor",
1142
+ "type": "string"
1143
+ },
1144
+ "italic": {
1145
+ "default": false,
1146
+ "description": "Whether the text is italic.",
1147
+ "title": "Italic",
1148
+ "type": "boolean"
1149
+ },
1150
+ "strikethrough": {
1151
+ "default": false,
1152
+ "description": "Whether the text has strikethrough.",
1153
+ "title": "Strikethrough",
1154
+ "type": "boolean"
1155
+ },
1156
+ "underline": {
1157
+ "default": false,
1158
+ "description": "Whether the text is underlined.",
1159
+ "title": "Underline",
1160
+ "type": "boolean"
1161
+ }
1162
+ },
1163
+ "title": "TextAnnotations",
1164
+ "type": "object"
1165
+ },
1166
+ {
1167
+ "type": "null"
1168
+ }
1169
+ ],
1170
+ "default": null,
1171
+ "description": "Optional text styling annotations (bold, italic, etc.)."
1172
+ },
1173
+ "text": {
1174
+ "description": "The text content object.",
1175
+ "properties": {
1176
+ "content": {
1177
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
1178
+ "examples": ["Hello, World!", "This is a paragraph of text."],
1179
+ "maxLength": 2000,
1180
+ "title": "Content",
1181
+ "type": "string"
1182
+ },
1183
+ "link": {
1184
+ "anyOf": [
1185
+ {
1186
+ "description": "Link object for hyperlinked text.",
1187
+ "properties": {
1188
+ "url": {
1189
+ "description": "The URL the text links to.",
1190
+ "examples": [
1191
+ "https://www.notion.so",
1192
+ "https://example.com"
1193
+ ],
1194
+ "title": "Url",
1195
+ "type": "string"
1196
+ }
1197
+ },
1198
+ "required": ["url"],
1199
+ "title": "TextLink",
1200
+ "type": "object"
1201
+ },
1202
+ {
1203
+ "type": "null"
1204
+ }
1205
+ ],
1206
+ "default": null,
1207
+ "description": "Optional link for the text."
1208
+ }
1209
+ },
1210
+ "required": ["content"],
1211
+ "title": "TextContent",
1212
+ "type": "object"
1213
+ },
1214
+ "type": {
1215
+ "const": "text",
1216
+ "default": "text",
1217
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
1218
+ "title": "Type",
1219
+ "type": "string"
1220
+ }
1221
+ },
1222
+ "required": ["text"],
1223
+ "title": "RichTextInput",
1224
+ "type": "object"
1225
+ },
1226
+ "minItems": 1,
1227
+ "title": "Rich Text",
1228
+ "type": "array"
1229
+ }
1230
+ },
1231
+ "required": ["rich_text"],
1232
+ "title": "ListItemInput",
1233
+ "type": "object"
1234
+ },
1235
+ "object": {
1236
+ "const": "block",
1237
+ "default": "block",
1238
+ "description": "Always 'block'.",
1239
+ "title": "Object",
1240
+ "type": "string"
1241
+ },
1242
+ "type": {
1243
+ "const": "numbered_list_item",
1244
+ "default": "numbered_list_item",
1245
+ "description": "Block type.",
1246
+ "title": "Type",
1247
+ "type": "string"
1248
+ }
1249
+ },
1250
+ "required": ["numbered_list_item"],
1251
+ "title": "NumberedListItemBlockInput",
1252
+ "type": "object"
1253
+ }
1254
+ ],
1255
+ "properties": {}
1256
+ },
1257
+ "maxItems": 100,
1258
+ "title": "Children",
1259
+ "type": "array"
1260
+ }
1261
+ },
1262
+ "required": ["block_id", "children"],
1263
+ "title": "AppendTextBlocksRequest",
1264
+ "type": "object"
1265
+ },
1266
+ "output_parameters": {
1267
+ "properties": {
1268
+ "data": {
1269
+ "additionalProperties": false,
1270
+ "description": "Data from the action execution",
1271
+ "properties": {
1272
+ "block": {
1273
+ "additionalProperties": {
1274
+ "type": "string"
1275
+ },
1276
+ "description": "Empty object corresponding to the type field.",
1277
+ "title": "Block",
1278
+ "type": "object"
1279
+ },
1280
+ "has_more": {
1281
+ "description": "Whether there are more results available beyond this page.",
1282
+ "title": "Has More",
1283
+ "type": "boolean"
1284
+ },
1285
+ "next_cursor": {
1286
+ "anyOf": [
1287
+ {
1288
+ "type": "string"
1289
+ },
1290
+ {
1291
+ "type": "null"
1292
+ }
1293
+ ],
1294
+ "default": null,
1295
+ "description": "Cursor for pagination. Null if there are no more results.",
1296
+ "title": "Next Cursor"
1297
+ },
1298
+ "object": {
1299
+ "description": "Always 'list' for paginated responses.",
1300
+ "title": "Object",
1301
+ "type": "string"
1302
+ },
1303
+ "results": {
1304
+ "description": "Array of newly created block objects that were appended as children.",
1305
+ "items": {
1306
+ "additionalProperties": true,
1307
+ "description": "Notion block object returned in the results array.",
1308
+ "properties": {
1309
+ "archived": {
1310
+ "anyOf": [
1311
+ {
1312
+ "type": "boolean"
1313
+ },
1314
+ {
1315
+ "type": "null"
1316
+ }
1317
+ ],
1318
+ "default": null,
1319
+ "description": "Whether the block is archived.",
1320
+ "title": "Archived"
1321
+ },
1322
+ "created_by": {
1323
+ "anyOf": [
1324
+ {
1325
+ "description": "Partial user object representing a Notion user.",
1326
+ "properties": {
1327
+ "id": {
1328
+ "description": "Unique identifier for the user (UUID format).",
1329
+ "title": "Id",
1330
+ "type": "string"
1331
+ },
1332
+ "object": {
1333
+ "description": "Always 'user'.",
1334
+ "title": "Object",
1335
+ "type": "string"
1336
+ }
1337
+ },
1338
+ "required": ["object", "id"],
1339
+ "title": "PartialUser",
1340
+ "type": "object"
1341
+ },
1342
+ {
1343
+ "type": "null"
1344
+ }
1345
+ ],
1346
+ "default": null,
1347
+ "description": "Partial user object representing the user who created the block.",
1348
+ "title": "Created By"
1349
+ },
1350
+ "created_time": {
1351
+ "anyOf": [
1352
+ {
1353
+ "type": "string"
1354
+ },
1355
+ {
1356
+ "type": "null"
1357
+ }
1358
+ ],
1359
+ "default": null,
1360
+ "description": "ISO 8601 timestamp of when the block was created.",
1361
+ "title": "Created Time"
1362
+ },
1363
+ "has_children": {
1364
+ "anyOf": [
1365
+ {
1366
+ "type": "boolean"
1367
+ },
1368
+ {
1369
+ "type": "null"
1370
+ }
1371
+ ],
1372
+ "default": null,
1373
+ "description": "Whether the block has child blocks nested within it.",
1374
+ "title": "Has Children"
1375
+ },
1376
+ "id": {
1377
+ "description": "Unique identifier for the block (UUID v4 format).",
1378
+ "title": "Id",
1379
+ "type": "string"
1380
+ },
1381
+ "in_trash": {
1382
+ "anyOf": [
1383
+ {
1384
+ "type": "boolean"
1385
+ },
1386
+ {
1387
+ "type": "null"
1388
+ }
1389
+ ],
1390
+ "default": null,
1391
+ "description": "Whether the block is in the trash.",
1392
+ "title": "In Trash"
1393
+ },
1394
+ "last_edited_by": {
1395
+ "anyOf": [
1396
+ {
1397
+ "description": "Partial user object representing a Notion user.",
1398
+ "properties": {
1399
+ "id": {
1400
+ "description": "Unique identifier for the user (UUID format).",
1401
+ "title": "Id",
1402
+ "type": "string"
1403
+ },
1404
+ "object": {
1405
+ "description": "Always 'user'.",
1406
+ "title": "Object",
1407
+ "type": "string"
1408
+ }
1409
+ },
1410
+ "required": ["object", "id"],
1411
+ "title": "PartialUser",
1412
+ "type": "object"
1413
+ },
1414
+ {
1415
+ "type": "null"
1416
+ }
1417
+ ],
1418
+ "default": null,
1419
+ "description": "Partial user object representing the user who last edited the block.",
1420
+ "title": "Last Edited By"
1421
+ },
1422
+ "last_edited_time": {
1423
+ "anyOf": [
1424
+ {
1425
+ "type": "string"
1426
+ },
1427
+ {
1428
+ "type": "null"
1429
+ }
1430
+ ],
1431
+ "default": null,
1432
+ "description": "ISO 8601 timestamp of when the block was last edited.",
1433
+ "title": "Last Edited Time"
1434
+ },
1435
+ "object": {
1436
+ "description": "Always 'block'.",
1437
+ "title": "Object",
1438
+ "type": "string"
1439
+ },
1440
+ "parent": {
1441
+ "anyOf": [
1442
+ {
1443
+ "description": "Information about a block's parent.",
1444
+ "properties": {
1445
+ "block_id": {
1446
+ "anyOf": [
1447
+ {
1448
+ "type": "string"
1449
+ },
1450
+ {
1451
+ "type": "null"
1452
+ }
1453
+ ],
1454
+ "default": null,
1455
+ "description": "UUID of the parent block (when type is 'block_id').",
1456
+ "title": "Block Id"
1457
+ },
1458
+ "data_source_id": {
1459
+ "anyOf": [
1460
+ {
1461
+ "type": "string"
1462
+ },
1463
+ {
1464
+ "type": "null"
1465
+ }
1466
+ ],
1467
+ "default": null,
1468
+ "description": "UUID of the parent data source (when type is 'data_source_id').",
1469
+ "title": "Data Source Id"
1470
+ },
1471
+ "page_id": {
1472
+ "anyOf": [
1473
+ {
1474
+ "type": "string"
1475
+ },
1476
+ {
1477
+ "type": "null"
1478
+ }
1479
+ ],
1480
+ "default": null,
1481
+ "description": "UUID of the parent page (when type is 'page_id').",
1482
+ "title": "Page Id"
1483
+ },
1484
+ "type": {
1485
+ "description": "Type of parent: 'page_id', 'block_id', or 'data_source_id'.",
1486
+ "enum": ["page_id", "block_id", "data_source_id"],
1487
+ "title": "Type",
1488
+ "type": "string"
1489
+ }
1490
+ },
1491
+ "required": ["type"],
1492
+ "title": "BlockParent",
1493
+ "type": "object"
1494
+ },
1495
+ {
1496
+ "type": "null"
1497
+ }
1498
+ ],
1499
+ "default": null,
1500
+ "description": "Information about the block's parent.",
1501
+ "title": "Parent"
1502
+ },
1503
+ "type": {
1504
+ "description": "The type of block.",
1505
+ "title": "Type",
1506
+ "type": "string"
1507
+ }
1508
+ },
1509
+ "required": ["object", "id", "type"],
1510
+ "title": "Block",
1511
+ "type": "object"
1512
+ },
1513
+ "title": "Results",
1514
+ "type": "array"
1515
+ },
1516
+ "type": {
1517
+ "description": "The type of items in the results array. Always 'block'.",
1518
+ "title": "Type",
1519
+ "type": "string"
1520
+ }
1521
+ },
1522
+ "required": ["object", "results", "has_more", "type", "block"],
1523
+ "title": "Data",
1524
+ "type": "object"
1525
+ },
1526
+ "error": {
1527
+ "anyOf": [
1528
+ {
1529
+ "type": "string"
1530
+ },
1531
+ {
1532
+ "type": "null"
1533
+ }
1534
+ ],
1535
+ "default": null,
1536
+ "description": "Error if any occurred during the execution of the action",
1537
+ "title": "Error"
1538
+ },
1539
+ "successful": {
1540
+ "description": "Whether or not the action execution was successful or not",
1541
+ "title": "Successful",
1542
+ "type": "boolean"
1543
+ }
1544
+ },
1545
+ "required": ["data", "successful"],
1546
+ "title": "AppendBlocksResponseWrapper",
1547
+ "type": "object"
1548
+ },
1549
+ "scopes": [],
1550
+ "tags": ["blocks", "text"],
1551
+ "no_auth": false,
1552
+ "status": "active",
1553
+ "is_deprecated": false,
1554
+ "deprecated": {
1555
+ "displayName": "Append text blocks (paragraphs, headings, lists)",
1556
+ "version": "20260113_00",
1557
+ "available_versions": ["20260113_00"],
1558
+ "is_deprecated": false,
1559
+ "toolkit": {
1560
+ "logo": "https://logos.composio.dev/api/notion"
1561
+ }
1562
+ }
1563
+}
ts/packages/cli/test/__fixtures__/notion-archive-page.json
new
+540
@@ -0,0 +1,540 @@
1
+{
2
+ "slug": "NOTION_ARCHIVE_NOTION_PAGE",
3
+ "name": "Archive Notion Page",
4
+ "description": "Archives (moves to trash) or unarchives (restores from trash) a specified Notion page.",
5
+ "available_versions": ["20260113_00"],
6
+ "version": "20260113_00",
7
+ "toolkit": {
8
+ "slug": "notion",
9
+ "name": "notion",
10
+ "logo": "https://logos.composio.dev/api/notion"
11
+ },
12
+ "input_parameters": {
13
+ "properties": {
14
+ "archive": {
15
+ "default": true,
16
+ "description": "Set to `true` to move the page to trash (archive), or `false` to restore it from trash (unarchive). Defaults to `true`.",
17
+ "title": "Archive",
18
+ "type": "boolean"
19
+ },
20
+ "page_id": {
21
+ "description": "The unique identifier (UUID) of the Notion page to be archived or unarchived. This must be a page ID, not a database ID. Database IDs cannot be used with this action - databases must be archived using the archive database action instead. Page IDs can be obtained using NOTION_SEARCH_NOTION_PAGE with filter_value='page' or from the 'id' field of page objects returned by other Notion actions.",
22
+ "examples": ["a1b2c3d4-e5f6-7890-1234-567890abcdef"],
23
+ "title": "Page Id",
24
+ "type": "string"
25
+ }
26
+ },
27
+ "required": ["page_id"],
28
+ "title": "ArchiveNotionPageRequest",
29
+ "type": "object"
30
+ },
31
+ "output_parameters": {
32
+ "properties": {
33
+ "data": {
34
+ "additionalProperties": false,
35
+ "description": "Data from the action execution",
36
+ "properties": {
37
+ "archived": {
38
+ "anyOf": [
39
+ {
40
+ "type": "boolean"
41
+ },
42
+ {
43
+ "type": "null"
44
+ }
45
+ ],
46
+ "default": null,
47
+ "description": "Indicates whether the page is archived. Set to true when the page is archived.",
48
+ "title": "Archived"
49
+ },
50
+ "cover": {
51
+ "anyOf": [
52
+ {
53
+ "properties": {
54
+ "external": {
55
+ "description": "External file configuration.",
56
+ "properties": {
57
+ "url": {
58
+ "description": "Publicly accessible HTTPS link to remote content.",
59
+ "title": "Url",
60
+ "type": "string"
61
+ }
62
+ },
63
+ "required": ["url"],
64
+ "title": "ExternalFile",
65
+ "type": "object"
66
+ },
67
+ "type": {
68
+ "const": "external",
69
+ "description": "The constant string 'external'.",
70
+ "title": "Type",
71
+ "type": "string"
72
+ }
73
+ },
74
+ "required": ["type", "external"],
75
+ "title": "ExternalCover",
76
+ "type": "object"
77
+ },
78
+ {
79
+ "properties": {
80
+ "file": {
81
+ "description": "Notion-hosted file configuration.",
82
+ "properties": {
83
+ "expiry_time": {
84
+ "description": "Timestamp in ISO 8601 format indicating when access expires.",
85
+ "title": "Expiry Time",
86
+ "type": "string"
87
+ },
88
+ "url": {
89
+ "description": "An authenticated HTTP GET URL to the file. The URL is valid for one hour.",
90
+ "title": "Url",
91
+ "type": "string"
92
+ }
93
+ },
94
+ "required": ["url", "expiry_time"],
95
+ "title": "NotionHostedFile",
96
+ "type": "object"
97
+ },
98
+ "type": {
99
+ "const": "file",
100
+ "description": "The constant string 'file'.",
101
+ "title": "Type",
102
+ "type": "string"
103
+ }
104
+ },
105
+ "required": ["type", "file"],
106
+ "title": "FileCover",
107
+ "type": "object"
108
+ },
109
+ {
110
+ "type": "null"
111
+ }
112
+ ],
113
+ "default": null,
114
+ "description": "Page cover image as a file object (external or Notion-hosted).",
115
+ "title": "Cover"
116
+ },
117
+ "created_by": {
118
+ "anyOf": [
119
+ {
120
+ "properties": {
121
+ "id": {
122
+ "description": "UUID string identifying the user uniquely.",
123
+ "title": "Id",
124
+ "type": "string"
125
+ },
126
+ "object": {
127
+ "const": "user",
128
+ "description": "Always \"user\".",
129
+ "title": "Object",
130
+ "type": "string"
131
+ }
132
+ },
133
+ "required": ["object", "id"],
134
+ "title": "UserPartial",
135
+ "type": "object"
136
+ },
137
+ {
138
+ "type": "null"
139
+ }
140
+ ],
141
+ "default": null,
142
+ "description": "Partial user object representing the user who created the page.",
143
+ "title": "Created By"
144
+ },
145
+ "created_time": {
146
+ "anyOf": [
147
+ {
148
+ "type": "string"
149
+ },
150
+ {
151
+ "type": "null"
152
+ }
153
+ ],
154
+ "default": null,
155
+ "description": "Creation timestamp in ISO 8601 format.",
156
+ "title": "Created Time"
157
+ },
158
+ "icon": {
159
+ "anyOf": [
160
+ {
161
+ "properties": {
162
+ "emoji": {
163
+ "description": "The emoji character itself.",
164
+ "title": "Emoji",
165
+ "type": "string"
166
+ },
167
+ "type": {
168
+ "const": "emoji",
169
+ "description": "The constant string 'emoji'.",
170
+ "title": "Type",
171
+ "type": "string"
172
+ }
173
+ },
174
+ "required": ["type", "emoji"],
175
+ "title": "EmojiIcon",
176
+ "type": "object"
177
+ },
178
+ {
179
+ "properties": {
180
+ "custom_emoji": {
181
+ "description": "Container object for custom emoji data.",
182
+ "properties": {
183
+ "id": {
184
+ "description": "Unique identifier for the custom emoji.",
185
+ "title": "Id",
186
+ "type": "string"
187
+ },
188
+ "name": {
189
+ "description": "Display name of the custom emoji.",
190
+ "title": "Name",
191
+ "type": "string"
192
+ },
193
+ "url": {
194
+ "description": "HTTPS URL pointing to the emoji image.",
195
+ "title": "Url",
196
+ "type": "string"
197
+ }
198
+ },
199
+ "required": ["id", "name", "url"],
200
+ "title": "CustomEmojiData",
201
+ "type": "object"
202
+ },
203
+ "type": {
204
+ "const": "custom_emoji",
205
+ "description": "The constant value 'custom_emoji'.",
206
+ "title": "Type",
207
+ "type": "string"
208
+ }
209
+ },
210
+ "required": ["type", "custom_emoji"],
211
+ "title": "CustomEmojiIcon",
212
+ "type": "object"
213
+ },
214
+ {
215
+ "properties": {
216
+ "external": {
217
+ "description": "External file configuration.",
218
+ "properties": {
219
+ "url": {
220
+ "description": "Publicly accessible HTTPS link to remote content.",
221
+ "title": "Url",
222
+ "type": "string"
223
+ }
224
+ },
225
+ "required": ["url"],
226
+ "title": "ExternalFile",
227
+ "type": "object"
228
+ },
229
+ "type": {
230
+ "const": "external",
231
+ "description": "The constant string 'external'.",
232
+ "title": "Type",
233
+ "type": "string"
234
+ }
235
+ },
236
+ "required": ["type", "external"],
237
+ "title": "ExternalIcon",
238
+ "type": "object"
239
+ },
240
+ {
241
+ "properties": {
242
+ "file": {
243
+ "description": "Notion-hosted file configuration.",
244
+ "properties": {
245
+ "expiry_time": {
246
+ "description": "Timestamp in ISO 8601 format indicating when access expires.",
247
+ "title": "Expiry Time",
248
+ "type": "string"
249
+ },
250
+ "url": {
251
+ "description": "An authenticated HTTP GET URL to the file. The URL is valid for one hour.",
252
+ "title": "Url",
253
+ "type": "string"
254
+ }
255
+ },
256
+ "required": ["url", "expiry_time"],
257
+ "title": "NotionHostedFile",
258
+ "type": "object"
259
+ },
260
+ "type": {
261
+ "const": "file",
262
+ "description": "The constant string 'file'.",
263
+ "title": "Type",
264
+ "type": "string"
265
+ }
266
+ },
267
+ "required": ["type", "file"],
268
+ "title": "FileIcon",
269
+ "type": "object"
270
+ },
271
+ {
272
+ "type": "null"
273
+ }
274
+ ],
275
+ "default": null,
276
+ "description": "Page icon, which can be an emoji or file object (external or uploaded).",
277
+ "title": "Icon"
278
+ },
279
+ "id": {
280
+ "description": "Unique page identifier in UUIDv4 format.",
281
+ "title": "Id",
282
+ "type": "string"
283
+ },
284
+ "in_trash": {
285
+ "anyOf": [
286
+ {
287
+ "type": "boolean"
288
+ },
289
+ {
290
+ "type": "null"
291
+ }
292
+ ],
293
+ "default": null,
294
+ "description": "Indicates whether the page is in trash. Set to true when the page is archived.",
295
+ "title": "In Trash"
296
+ },
297
+ "last_edited_by": {
298
+ "anyOf": [
299
+ {
300
+ "properties": {
301
+ "id": {
302
+ "description": "UUID string identifying the user uniquely.",
303
+ "title": "Id",
304
+ "type": "string"
305
+ },
306
+ "object": {
307
+ "const": "user",
308
+ "description": "Always \"user\".",
309
+ "title": "Object",
310
+ "type": "string"
311
+ }
312
+ },
313
+ "required": ["object", "id"],
314
+ "title": "UserPartial",
315
+ "type": "object"
316
+ },
317
+ {
318
+ "type": "null"
319
+ }
320
+ ],
321
+ "default": null,
322
+ "description": "Partial user object representing the user who last edited the page.",
323
+ "title": "Last Edited By"
324
+ },
325
+ "last_edited_time": {
326
+ "anyOf": [
327
+ {
328
+ "type": "string"
329
+ },
330
+ {
331
+ "type": "null"
332
+ }
333
+ ],
334
+ "default": null,
335
+ "description": "Most recent modification timestamp in ISO 8601 format.",
336
+ "title": "Last Edited Time"
337
+ },
338
+ "object": {
339
+ "const": "page",
340
+ "description": "Always the literal value 'page'.",
341
+ "title": "Object",
342
+ "type": "string"
343
+ },
344
+ "parent": {
345
+ "anyOf": [
346
+ {
347
+ "properties": {
348
+ "database_id": {
349
+ "description": "UUIDv4 string identifying the parent database.",
350
+ "title": "Database Id",
351
+ "type": "string"
352
+ },
353
+ "type": {
354
+ "const": "database_id",
355
+ "description": "The constant string 'database_id'.",
356
+ "title": "Type",
357
+ "type": "string"
358
+ }
359
+ },
360
+ "required": ["type", "database_id"],
361
+ "title": "DatabaseParent",
362
+ "type": "object"
363
+ },
364
+ {
365
+ "properties": {
366
+ "data_source_id": {
367
+ "description": "UUIDv4 string identifying the parent data source.",
368
+ "title": "Data Source Id",
369
+ "type": "string"
370
+ },
371
+ "database_id": {
372
+ "anyOf": [
373
+ {
374
+ "type": "string"
375
+ },
376
+ {
377
+ "type": "null"
378
+ }
379
+ ],
380
+ "default": null,
381
+ "description": "UUIDv4 string for the grandparent database (convenience field).",
382
+ "title": "Database Id"
383
+ },
384
+ "type": {
385
+ "const": "data_source_id",
386
+ "description": "The constant string 'data_source_id'.",
387
+ "title": "Type",
388
+ "type": "string"
389
+ }
390
+ },
391
+ "required": ["type", "data_source_id"],
392
+ "title": "DataSourceParent",
393
+ "type": "object"
394
+ },
395
+ {
396
+ "properties": {
397
+ "page_id": {
398
+ "description": "UUIDv4 string identifying the parent page.",
399
+ "title": "Page Id",
400
+ "type": "string"
401
+ },
402
+ "type": {
403
+ "const": "page_id",
404
+ "description": "The constant string 'page_id'.",
405
+ "title": "Type",
406
+ "type": "string"
407
+ }
408
+ },
409
+ "required": ["type", "page_id"],
410
+ "title": "PageParent",
411
+ "type": "object"
412
+ },
413
+ {
414
+ "properties": {
415
+ "type": {
416
+ "const": "workspace",
417
+ "description": "The constant string 'workspace'.",
418
+ "title": "Type",
419
+ "type": "string"
420
+ },
421
+ "workspace": {
422
+ "const": true,
423
+ "description": "Always true, indicating the page is at workspace level.",
424
+ "title": "Workspace",
425
+ "type": "boolean"
426
+ }
427
+ },
428
+ "required": ["type", "workspace"],
429
+ "title": "WorkspaceParent",
430
+ "type": "object"
431
+ },
432
+ {
433
+ "properties": {
434
+ "block_id": {
435
+ "description": "UUIDv4 string identifying the parent block.",
436
+ "title": "Block Id",
437
+ "type": "string"
438
+ },
439
+ "type": {
440
+ "const": "block_id",
441
+ "description": "The constant string 'block_id'.",
442
+ "title": "Type",
443
+ "type": "string"
444
+ }
445
+ },
446
+ "required": ["type", "block_id"],
447
+ "title": "BlockParent",
448
+ "type": "object"
449
+ },
450
+ {
451
+ "type": "null"
452
+ }
453
+ ],
454
+ "default": null,
455
+ "description": "Parent container information specifying where the page is located.",
456
+ "title": "Parent"
457
+ },
458
+ "properties": {
459
+ "anyOf": [
460
+ {
461
+ "additionalProperties": true,
462
+ "type": "object"
463
+ },
464
+ {
465
+ "type": "null"
466
+ }
467
+ ],
468
+ "default": null,
469
+ "description": "Key-value pairs of page property data. The structure depends on the parent type and specific properties defined for the page.",
470
+ "title": "Properties"
471
+ },
472
+ "public_url": {
473
+ "anyOf": [
474
+ {
475
+ "type": "string"
476
+ },
477
+ {
478
+ "type": "null"
479
+ }
480
+ ],
481
+ "default": null,
482
+ "description": "Public web URL if the page is published; otherwise null.",
483
+ "title": "Public Url"
484
+ },
485
+ "url": {
486
+ "anyOf": [
487
+ {
488
+ "type": "string"
489
+ },
490
+ {
491
+ "type": "null"
492
+ }
493
+ ],
494
+ "default": null,
495
+ "description": "Standard Notion page URL.",
496
+ "title": "Url"
497
+ }
498
+ },
499
+ "required": ["object", "id"],
500
+ "title": "Data",
501
+ "type": "object"
502
+ },
503
+ "error": {
504
+ "anyOf": [
505
+ {
506
+ "type": "string"
507
+ },
508
+ {
509
+ "type": "null"
510
+ }
511
+ ],
512
+ "default": null,
513
+ "description": "Error if any occurred during the execution of the action",
514
+ "title": "Error"
515
+ },
516
+ "successful": {
517
+ "description": "Whether or not the action execution was successful or not",
518
+ "title": "Successful",
519
+ "type": "boolean"
520
+ }
521
+ },
522
+ "required": ["data", "successful"],
523
+ "title": "ArchiveNotionPageResponseWrapper",
524
+ "type": "object"
525
+ },
526
+ "scopes": ["Read content"],
527
+ "tags": ["destructiveHint", "openWorldHint"],
528
+ "no_auth": false,
529
+ "status": "active",
530
+ "is_deprecated": false,
531
+ "deprecated": {
532
+ "displayName": "Archive Notion Page",
533
+ "version": "20260113_00",
534
+ "available_versions": ["20260113_00"],
535
+ "is_deprecated": false,
536
+ "toolkit": {
537
+ "logo": "https://logos.composio.dev/api/notion"
538
+ }
539
+ }
540
+}
ts/packages/cli/test/__fixtures__/notion-create-comment.json
new
+676
@@ -0,0 +1,676 @@
1
+{
2
+ "slug": "NOTION_CREATE_COMMENT",
3
+ "name": "Create comment",
4
+ "description": "Adds a comment to a Notion page (via `parent_page_id`) OR to an existing discussion thread (via `discussion_id`); cannot create new discussion threads on specific blocks (inline comments).",
5
+ "available_versions": ["20260113_00"],
6
+ "version": "20260113_00",
7
+ "toolkit": {
8
+ "slug": "notion",
9
+ "name": "notion",
10
+ "logo": "https://logos.composio.dev/api/notion"
11
+ },
12
+ "input_parameters": {
13
+ "properties": {
14
+ "comment": {
15
+ "additionalProperties": false,
16
+ "description": "Content of the comment as a NotionRichText object or a JSON string. Simplest form: {'content': 'Looks good!'} or {'text': 'Looks good!'} (both 'content' and 'text' are accepted as the field name). Can also be passed as a JSON string: '{\"content\": \"Looks good!\"}'. Optional styling fields: bold, italic, link, etc. Do NOT wrap this in a list or use Notion API block JSON.",
17
+ "examples": [
18
+ {
19
+ "content": "Looks good to me!"
20
+ },
21
+ {
22
+ "text": "Great work!"
23
+ },
24
+ {
25
+ "bold": true,
26
+ "content": "Fix typo"
27
+ }
28
+ ],
29
+ "properties": {
30
+ "block_property": {
31
+ "default": "paragraph",
32
+ "description": "The block property of the block to be added. Possible properties are `paragraph`, `heading_1`, `heading_2`, `heading_3`, `callout`, `to_do`, `toggle`, `quote`, `bulleted_list_item`, `numbered_list_item`. Other properties possible are `file`, `image`, `video` (link required), and `divider` (creates a horizontal divider line, no content required).",
33
+ "enum": [
34
+ "paragraph",
35
+ "heading_1",
36
+ "heading_2",
37
+ "heading_3",
38
+ "callout",
39
+ "to_do",
40
+ "toggle",
41
+ "quote",
42
+ "bulleted_list_item",
43
+ "numbered_list_item",
44
+ "file",
45
+ "image",
46
+ "video",
47
+ "divider"
48
+ ],
49
+ "examples": [
50
+ "paragraph",
51
+ "heading_1",
52
+ "heading_2",
53
+ "heading_3",
54
+ "bulleted_list_item",
55
+ "numbered_list_item",
56
+ "to_do",
57
+ "callout",
58
+ "toggle",
59
+ "quote",
60
+ "divider"
61
+ ],
62
+ "title": "Block Property",
63
+ "type": "string"
64
+ },
65
+ "bold": {
66
+ "default": false,
67
+ "description": "Indicates if the text is bold.",
68
+ "examples": [true, false],
69
+ "title": "Bold",
70
+ "type": "boolean"
71
+ },
72
+ "code": {
73
+ "default": false,
74
+ "description": "Indicates if the text is formatted as code.",
75
+ "examples": [true, false],
76
+ "title": "Code",
77
+ "type": "boolean"
78
+ },
79
+ "color": {
80
+ "default": "default",
81
+ "description": "The color of the text background or text itself.",
82
+ "examples": ["blue_background", "yellow_background", "gray", "purple"],
83
+ "title": "Color",
84
+ "type": "string"
85
+ },
86
+ "content": {
87
+ "anyOf": [
88
+ {
89
+ "type": "string"
90
+ },
91
+ {
92
+ "type": "null"
93
+ }
94
+ ],
95
+ "default": null,
96
+ "description": "The textual content of the rich text object. ENHANCED: Now automatically parses markdown formatting including bold (**text**), italic (*text*), strikethrough (~~text~~), inline code (`code`), and links ([text](url)). Required for paragraph, heading_1, heading_2, heading_3, callout, to_do, toggle, quote.",
97
+ "examples": [
98
+ "Hello World",
99
+ "This is **bold** and *italic* text",
100
+ "Visit [our site](https://example.com)",
101
+ "Use `code` snippets",
102
+ "~~Strikethrough~~ text"
103
+ ],
104
+ "title": "Content"
105
+ },
106
+ "italic": {
107
+ "default": false,
108
+ "description": "Indicates if the text is italic.",
109
+ "examples": [true, false],
110
+ "title": "Italic",
111
+ "type": "boolean"
112
+ },
113
+ "link": {
114
+ "anyOf": [
115
+ {
116
+ "type": "string"
117
+ },
118
+ {
119
+ "type": "null"
120
+ }
121
+ ],
122
+ "default": null,
123
+ "description": "The URL of the rich text object or the file to be uploaded or image/video link",
124
+ "examples": ["https://www.google.com"],
125
+ "title": "Link"
126
+ },
127
+ "strikethrough": {
128
+ "default": false,
129
+ "description": "Indicates if the text has strikethrough.",
130
+ "examples": [true, false],
131
+ "title": "Strikethrough",
132
+ "type": "boolean"
133
+ },
134
+ "underline": {
135
+ "default": false,
136
+ "description": "Indicates if the text is underlined.",
137
+ "examples": [true, false],
138
+ "title": "Underline",
139
+ "type": "boolean"
140
+ }
141
+ },
142
+ "title": "Comment",
143
+ "type": "object"
144
+ },
145
+ "discussion_id": {
146
+ "anyOf": [
147
+ {
148
+ "type": "string"
149
+ },
150
+ {
151
+ "type": "null"
152
+ }
153
+ ],
154
+ "default": null,
155
+ "description": "The ID of an existing discussion thread to which the comment will be added. This is required if `parent_page_id` is not provided.",
156
+ "examples": ["yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"],
157
+ "title": "Discussion Id"
158
+ },
159
+ "parent_page_id": {
160
+ "anyOf": [
161
+ {
162
+ "type": "string"
163
+ },
164
+ {
165
+ "type": "null"
166
+ }
167
+ ],
168
+ "default": null,
169
+ "description": "The ID of the Notion page where the comment will be added. This is required if `discussion_id` is not provided. Page IDs can be obtained using other Notion actions that fetch page details or list pages.",
170
+ "examples": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],
171
+ "title": "Parent Page Id"
172
+ }
173
+ },
174
+ "required": ["comment"],
175
+ "title": "CreateCommentRequest",
176
+ "type": "object"
177
+ },
178
+ "output_parameters": {
179
+ "properties": {
180
+ "data": {
181
+ "additionalProperties": false,
182
+ "description": "Data from the action execution",
183
+ "properties": {
184
+ "attachments": {
185
+ "anyOf": [
186
+ {
187
+ "items": {
188
+ "description": "File attachment on a comment.",
189
+ "properties": {
190
+ "category": {
191
+ "description": "The category of this attachment. Possible values are: 'audio', 'image', 'pdf', 'productivity', and 'video'.",
192
+ "title": "Category",
193
+ "type": "string"
194
+ },
195
+ "file": {
196
+ "description": "File object containing temporary download information.",
197
+ "properties": {
198
+ "expiry_time": {
199
+ "description": "ISO 8601 timestamp indicating when the temporary download URL expires.",
200
+ "title": "Expiry Time",
201
+ "type": "string"
202
+ },
203
+ "url": {
204
+ "description": "A temporary download link generated at the time of retrieving the comment.",
205
+ "title": "Url",
206
+ "type": "string"
207
+ }
208
+ },
209
+ "required": ["url", "expiry_time"],
210
+ "title": "NotionCommentAttachmentFile",
211
+ "type": "object"
212
+ }
213
+ },
214
+ "required": ["category", "file"],
215
+ "title": "NotionCommentAttachment",
216
+ "type": "object"
217
+ },
218
+ "type": "array"
219
+ },
220
+ {
221
+ "type": "null"
222
+ }
223
+ ],
224
+ "default": null,
225
+ "description": "Array of file attachments on the comment (maximum 3 attachments).",
226
+ "title": "Attachments"
227
+ },
228
+ "created_by": {
229
+ "anyOf": [
230
+ {
231
+ "description": "Partial user object containing information about the comment author.",
232
+ "properties": {
233
+ "id": {
234
+ "description": "Unique identifier for the user in UUID format.",
235
+ "title": "Id",
236
+ "type": "string"
237
+ },
238
+ "object": {
239
+ "const": "user",
240
+ "default": "user",
241
+ "description": "Always 'user'.",
242
+ "title": "Object",
243
+ "type": "string"
244
+ }
245
+ },
246
+ "required": ["id"],
247
+ "title": "NotionPartialUser",
248
+ "type": "object"
249
+ },
250
+ {
251
+ "type": "null"
252
+ }
253
+ ],
254
+ "default": null,
255
+ "description": "Partial user object containing information about the comment author.",
256
+ "title": "Created By"
257
+ },
258
+ "created_time": {
259
+ "anyOf": [
260
+ {
261
+ "type": "string"
262
+ },
263
+ {
264
+ "type": "null"
265
+ }
266
+ ],
267
+ "default": null,
268
+ "description": "ISO 8601 timestamp marking when the comment was created.",
269
+ "title": "Created Time"
270
+ },
271
+ "discussion_id": {
272
+ "anyOf": [
273
+ {
274
+ "type": "string"
275
+ },
276
+ {
277
+ "type": "null"
278
+ }
279
+ ],
280
+ "default": null,
281
+ "description": "Thread identifier associating the comment with a discussion in UUIDv4 format.",
282
+ "title": "Discussion Id"
283
+ },
284
+ "display_name": {
285
+ "anyOf": [
286
+ {
287
+ "description": "Custom display name configuration for the comment author.",
288
+ "properties": {
289
+ "resolved_name": {
290
+ "description": "The finalized display name that is rendered in the comment.",
291
+ "title": "Resolved Name",
292
+ "type": "string"
293
+ },
294
+ "type": {
295
+ "description": "Type of display name. One of: 'integration', 'user', or 'custom'.",
296
+ "title": "Type",
297
+ "type": "string"
298
+ }
299
+ },
300
+ "required": ["type", "resolved_name"],
301
+ "title": "NotionDisplayName",
302
+ "type": "object"
303
+ },
304
+ {
305
+ "type": "null"
306
+ }
307
+ ],
308
+ "default": null,
309
+ "description": "Custom display name configuration for the comment author, overriding the default author name.",
310
+ "title": "Display Name"
311
+ },
312
+ "id": {
313
+ "anyOf": [
314
+ {
315
+ "type": "string"
316
+ },
317
+ {
318
+ "type": "null"
319
+ }
320
+ ],
321
+ "default": null,
322
+ "description": "Unique identifier for the comment in UUIDv4 format.",
323
+ "title": "Id"
324
+ },
325
+ "last_edited_time": {
326
+ "anyOf": [
327
+ {
328
+ "type": "string"
329
+ },
330
+ {
331
+ "type": "null"
332
+ }
333
+ ],
334
+ "default": null,
335
+ "description": "ISO 8601 timestamp of the most recent modification to the comment.",
336
+ "title": "Last Edited Time"
337
+ },
338
+ "object": {
339
+ "anyOf": [
340
+ {
341
+ "const": "comment",
342
+ "type": "string"
343
+ },
344
+ {
345
+ "type": "null"
346
+ }
347
+ ],
348
+ "default": null,
349
+ "description": "Always 'comment'.",
350
+ "title": "Object"
351
+ },
352
+ "parent": {
353
+ "anyOf": [
354
+ {
355
+ "description": "Parent reference when the comment is on a page.",
356
+ "properties": {
357
+ "page_id": {
358
+ "description": "Page identifier in UUIDv4 format.",
359
+ "title": "Page Id",
360
+ "type": "string"
361
+ },
362
+ "type": {
363
+ "const": "page_id",
364
+ "default": "page_id",
365
+ "description": "Type identifier for page parent.",
366
+ "title": "Type",
367
+ "type": "string"
368
+ }
369
+ },
370
+ "required": ["page_id"],
371
+ "title": "NotionCommentParentPage",
372
+ "type": "object"
373
+ },
374
+ {
375
+ "description": "Parent reference when the comment is on a block.",
376
+ "properties": {
377
+ "block_id": {
378
+ "description": "Block identifier in UUIDv4 format.",
379
+ "title": "Block Id",
380
+ "type": "string"
381
+ },
382
+ "type": {
383
+ "const": "block_id",
384
+ "default": "block_id",
385
+ "description": "Type identifier for block parent.",
386
+ "title": "Type",
387
+ "type": "string"
388
+ }
389
+ },
390
+ "required": ["block_id"],
391
+ "title": "NotionCommentParentBlock",
392
+ "type": "object"
393
+ },
394
+ {
395
+ "type": "null"
396
+ }
397
+ ],
398
+ "default": null,
399
+ "description": "References the comment's parent (page or block).",
400
+ "title": "Parent"
401
+ },
402
+ "rich_text": {
403
+ "anyOf": [
404
+ {
405
+ "items": {
406
+ "description": "Rich text element supporting text, mention, and equation types.",
407
+ "properties": {
408
+ "annotations": {
409
+ "anyOf": [
410
+ {
411
+ "description": "Styling configuration for rich text.",
412
+ "properties": {
413
+ "bold": {
414
+ "anyOf": [
415
+ {
416
+ "type": "boolean"
417
+ },
418
+ {
419
+ "type": "null"
420
+ }
421
+ ],
422
+ "default": null,
423
+ "description": "Whether the text is bold.",
424
+ "title": "Bold"
425
+ },
426
+ "code": {
427
+ "anyOf": [
428
+ {
429
+ "type": "boolean"
430
+ },
431
+ {
432
+ "type": "null"
433
+ }
434
+ ],
435
+ "default": null,
436
+ "description": "Whether the text is formatted as code.",
437
+ "title": "Code"
438
+ },
439
+ "color": {
440
+ "anyOf": [
441
+ {
442
+ "type": "string"
443
+ },
444
+ {
445
+ "type": "null"
446
+ }
447
+ ],
448
+ "default": null,
449
+ "description": "Text color. One of: 'default', 'gray', 'brown', 'orange', 'yellow', 'green', 'blue', 'purple', 'pink', 'red', or any of these with '_background' suffix.",
450
+ "title": "Color"
451
+ },
452
+ "italic": {
453
+ "anyOf": [
454
+ {
455
+ "type": "boolean"
456
+ },
457
+ {
458
+ "type": "null"
459
+ }
460
+ ],
461
+ "default": null,
462
+ "description": "Whether the text is italic.",
463
+ "title": "Italic"
464
+ },
465
+ "strikethrough": {
466
+ "anyOf": [
467
+ {
468
+ "type": "boolean"
469
+ },
470
+ {
471
+ "type": "null"
472
+ }
473
+ ],
474
+ "default": null,
475
+ "description": "Whether the text has strikethrough.",
476
+ "title": "Strikethrough"
477
+ },
478
+ "underline": {
479
+ "anyOf": [
480
+ {
481
+ "type": "boolean"
482
+ },
483
+ {
484
+ "type": "null"
485
+ }
486
+ ],
487
+ "default": null,
488
+ "description": "Whether the text is underlined.",
489
+ "title": "Underline"
490
+ }
491
+ },
492
+ "title": "RichTextAnnotations",
493
+ "type": "object"
494
+ },
495
+ {
496
+ "type": "null"
497
+ }
498
+ ],
499
+ "default": null,
500
+ "description": "Styling configuration for the rich text."
501
+ },
502
+ "equation": {
503
+ "anyOf": [
504
+ {
505
+ "description": "Equation content for an equation-type rich text element.",
506
+ "properties": {
507
+ "expression": {
508
+ "description": "LaTeX formula expression.",
509
+ "title": "Expression",
510
+ "type": "string"
511
+ }
512
+ },
513
+ "required": ["expression"],
514
+ "title": "RichTextEquation",
515
+ "type": "object"
516
+ },
517
+ {
518
+ "type": "null"
519
+ }
520
+ ],
521
+ "default": null,
522
+ "description": "Present when type is 'equation'. Contains the LaTeX expression."
523
+ },
524
+ "href": {
525
+ "anyOf": [
526
+ {
527
+ "type": "string"
528
+ },
529
+ {
530
+ "type": "null"
531
+ }
532
+ ],
533
+ "default": null,
534
+ "description": "URL if the text is a link, otherwise null.",
535
+ "title": "Href"
536
+ },
537
+ "mention": {
538
+ "anyOf": [
539
+ {
540
+ "additionalProperties": true,
541
+ "type": "object"
542
+ },
543
+ {
544
+ "type": "null"
545
+ }
546
+ ],
547
+ "default": null,
548
+ "description": "Present when type is 'mention'. Contains mention-specific properties for database, date, link_preview, page, user, or template_mention types.",
549
+ "title": "Mention"
550
+ },
551
+ "plain_text": {
552
+ "anyOf": [
553
+ {
554
+ "type": "string"
555
+ },
556
+ {
557
+ "type": "null"
558
+ }
559
+ ],
560
+ "default": null,
561
+ "description": "Unformatted text content, providing a convenient way to access text without styling.",
562
+ "title": "Plain Text"
563
+ },
564
+ "text": {
565
+ "anyOf": [
566
+ {
567
+ "description": "Text content for a text-type rich text element.",
568
+ "properties": {
569
+ "content": {
570
+ "description": "The actual text content.",
571
+ "title": "Content",
572
+ "type": "string"
573
+ },
574
+ "link": {
575
+ "anyOf": [
576
+ {
577
+ "description": "Link object within text content.",
578
+ "properties": {
579
+ "url": {
580
+ "description": "The URL of the link.",
581
+ "title": "Url",
582
+ "type": "string"
583
+ }
584
+ },
585
+ "required": ["url"],
586
+ "title": "RichTextLink",
587
+ "type": "object"
588
+ },
589
+ {
590
+ "type": "null"
591
+ }
592
+ ],
593
+ "default": null,
594
+ "description": "Link object containing URL, or null if no link."
595
+ }
596
+ },
597
+ "required": ["content"],
598
+ "title": "RichTextTextContent",
599
+ "type": "object"
600
+ },
601
+ {
602
+ "type": "null"
603
+ }
604
+ ],
605
+ "default": null,
606
+ "description": "Present when type is 'text'. Contains the text content and optional link."
607
+ },
608
+ "type": {
609
+ "anyOf": [
610
+ {
611
+ "type": "string"
612
+ },
613
+ {
614
+ "type": "null"
615
+ }
616
+ ],
617
+ "default": null,
618
+ "description": "Type of rich text element. One of: 'text', 'mention', 'equation'.",
619
+ "title": "Type"
620
+ }
621
+ },
622
+ "title": "RichTextElement",
623
+ "type": "object"
624
+ },
625
+ "type": "array"
626
+ },
627
+ {
628
+ "type": "null"
629
+ }
630
+ ],
631
+ "default": null,
632
+ "description": "Array of rich text objects representing the content of the comment, which supports rich text formatting and links.",
633
+ "title": "Rich Text"
634
+ }
635
+ },
636
+ "title": "Data",
637
+ "type": "object"
638
+ },
639
+ "error": {
640
+ "anyOf": [
641
+ {
642
+ "type": "string"
643
+ },
644
+ {
645
+ "type": "null"
646
+ }
647
+ ],
648
+ "default": null,
649
+ "description": "Error if any occurred during the execution of the action",
650
+ "title": "Error"
651
+ },
652
+ "successful": {
653
+ "description": "Whether or not the action execution was successful or not",
654
+ "title": "Successful",
655
+ "type": "boolean"
656
+ }
657
+ },
658
+ "required": ["data", "successful"],
659
+ "title": "CreateCommentResponseWrapper",
660
+ "type": "object"
661
+ },
662
+ "scopes": ["comment:write"],
663
+ "tags": ["important", "openWorldHint"],
664
+ "no_auth": false,
665
+ "status": "active",
666
+ "is_deprecated": false,
667
+ "deprecated": {
668
+ "displayName": "Create comment",
669
+ "version": "20260113_00",
670
+ "available_versions": ["20260113_00"],
671
+ "is_deprecated": false,
672
+ "toolkit": {
673
+ "logo": "https://logos.composio.dev/api/notion"
674
+ }
675
+ }
676
+}
ts/packages/cli/test/__fixtures__/notion-delete-block.json
new
+592
@@ -0,0 +1,592 @@
1
+{
2
+ "slug": "NOTION_DELETE_BLOCK",
3
+ "name": "Delete a block",
4
+ "description": "Archives a Notion block, page, or database using its ID, which sets its 'archived' property to true (like moving to \"Trash\" in the UI) and allows it to be restored later. Note: This operation will fail if the block has an archived parent or ancestor in the hierarchy. You must unarchive the ancestor before archiving/deleting its descendants.",
5
+ "available_versions": ["20260113_00"],
6
+ "version": "20260113_00",
7
+ "toolkit": {
8
+ "slug": "notion",
9
+ "name": "notion",
10
+ "logo": "https://logos.composio.dev/api/notion"
11
+ },
12
+ "input_parameters": {
13
+ "description": "Request model for deleting (archiving) a Notion block.",
14
+ "properties": {
15
+ "block_id": {
16
+ "description": "Identifier of the block, page, or database to be deleted (archived). Must be a valid Notion block/page/database ID in UUID format (with or without hyphens). To find page IDs and their titles, consider using an action like `NOTION_FETCH_DATA`.",
17
+ "examples": ["59833787-2cf9-4fdf-8782-e53db20768a5"],
18
+ "title": "Block Id",
19
+ "type": "string"
20
+ }
21
+ },
22
+ "required": ["block_id"],
23
+ "title": "DeleteBlockRequest",
24
+ "type": "object"
25
+ },
26
+ "output_parameters": {
27
+ "properties": {
28
+ "data": {
29
+ "additionalProperties": true,
30
+ "description": "Data from the action execution",
31
+ "properties": {
32
+ "archived": {
33
+ "description": "Whether the block is archived (deleted). Set to true after deletion, which moves the block to Trash in the Notion UI.",
34
+ "title": "Archived",
35
+ "type": "boolean"
36
+ },
37
+ "created_by": {
38
+ "additionalProperties": false,
39
+ "description": "User object representing who created the block.",
40
+ "properties": {
41
+ "avatar_url": {
42
+ "anyOf": [
43
+ {
44
+ "type": "string"
45
+ },
46
+ {
47
+ "type": "null"
48
+ }
49
+ ],
50
+ "default": null,
51
+ "description": "URL of the user's chosen avatar image.",
52
+ "title": "Avatar Url"
53
+ },
54
+ "bot": {
55
+ "anyOf": [
56
+ {
57
+ "properties": {
58
+ "owner": {
59
+ "anyOf": [
60
+ {
61
+ "properties": {
62
+ "type": {
63
+ "anyOf": [
64
+ {
65
+ "type": "string"
66
+ },
67
+ {
68
+ "type": "null"
69
+ }
70
+ ],
71
+ "default": null,
72
+ "description": "Either 'workspace' or 'user'.",
73
+ "title": "Type"
74
+ }
75
+ },
76
+ "title": "BotOwner",
77
+ "type": "object"
78
+ },
79
+ {
80
+ "type": "null"
81
+ }
82
+ ],
83
+ "default": null,
84
+ "description": "Owner information for the bot."
85
+ },
86
+ "workspace_id": {
87
+ "anyOf": [
88
+ {
89
+ "type": "string"
90
+ },
91
+ {
92
+ "type": "null"
93
+ }
94
+ ],
95
+ "default": null,
96
+ "description": "ID of the bot's workspace.",
97
+ "title": "Workspace Id"
98
+ },
99
+ "workspace_limits": {
100
+ "anyOf": [
101
+ {
102
+ "properties": {
103
+ "max_file_upload_size_in_bytes": {
104
+ "anyOf": [
105
+ {
106
+ "type": "integer"
107
+ },
108
+ {
109
+ "type": "null"
110
+ }
111
+ ],
112
+ "default": null,
113
+ "description": "Maximum file upload size in bytes.",
114
+ "title": "Max File Upload Size In Bytes"
115
+ }
116
+ },
117
+ "title": "WorkspaceLimits",
118
+ "type": "object"
119
+ },
120
+ {
121
+ "type": "null"
122
+ }
123
+ ],
124
+ "default": null,
125
+ "description": "Workspace restrictions for the bot."
126
+ },
127
+ "workspace_name": {
128
+ "anyOf": [
129
+ {
130
+ "type": "string"
131
+ },
132
+ {
133
+ "type": "null"
134
+ }
135
+ ],
136
+ "default": null,
137
+ "description": "Name of the bot's workspace. Null if owner type is 'user'.",
138
+ "title": "Workspace Name"
139
+ }
140
+ },
141
+ "title": "BotDetails",
142
+ "type": "object"
143
+ },
144
+ {
145
+ "type": "null"
146
+ }
147
+ ],
148
+ "default": null,
149
+ "description": "Present when type is 'bot'.",
150
+ "title": "Bot"
151
+ },
152
+ "id": {
153
+ "description": "Unique identifier for the user in UUID format.",
154
+ "title": "Id",
155
+ "type": "string"
156
+ },
157
+ "name": {
158
+ "anyOf": [
159
+ {
160
+ "type": "string"
161
+ },
162
+ {
163
+ "type": "null"
164
+ }
165
+ ],
166
+ "default": null,
167
+ "description": "User's name as displayed in Notion.",
168
+ "title": "Name"
169
+ },
170
+ "object": {
171
+ "description": "Always 'user'.",
172
+ "title": "Object",
173
+ "type": "string"
174
+ },
175
+ "person": {
176
+ "anyOf": [
177
+ {
178
+ "properties": {
179
+ "email": {
180
+ "anyOf": [
181
+ {
182
+ "type": "string"
183
+ },
184
+ {
185
+ "type": "null"
186
+ }
187
+ ],
188
+ "default": null,
189
+ "description": "Email address. Present only if integration has user capability access.",
190
+ "title": "Email"
191
+ }
192
+ },
193
+ "title": "PersonDetails",
194
+ "type": "object"
195
+ },
196
+ {
197
+ "type": "null"
198
+ }
199
+ ],
200
+ "default": null,
201
+ "description": "Present when type is 'person'.",
202
+ "title": "Person"
203
+ },
204
+ "type": {
205
+ "anyOf": [
206
+ {
207
+ "type": "string"
208
+ },
209
+ {
210
+ "type": "null"
211
+ }
212
+ ],
213
+ "default": null,
214
+ "description": "Type of user. Either 'person' or 'bot'.",
215
+ "title": "Type"
216
+ }
217
+ },
218
+ "required": ["object", "id"],
219
+ "title": "Created By",
220
+ "type": "object"
221
+ },
222
+ "created_time": {
223
+ "description": "ISO 8601 timestamp of when the block was created.",
224
+ "title": "Created Time",
225
+ "type": "string"
226
+ },
227
+ "has_children": {
228
+ "description": "Whether the block has child blocks.",
229
+ "title": "Has Children",
230
+ "type": "boolean"
231
+ },
232
+ "id": {
233
+ "description": "Unique identifier for the block in UUIDv4 format.",
234
+ "title": "Id",
235
+ "type": "string"
236
+ },
237
+ "in_trash": {
238
+ "description": "Whether the block is in trash (deleted).",
239
+ "title": "In Trash",
240
+ "type": "boolean"
241
+ },
242
+ "last_edited_by": {
243
+ "additionalProperties": false,
244
+ "description": "User object representing who last edited the block.",
245
+ "properties": {
246
+ "avatar_url": {
247
+ "anyOf": [
248
+ {
249
+ "type": "string"
250
+ },
251
+ {
252
+ "type": "null"
253
+ }
254
+ ],
255
+ "default": null,
256
+ "description": "URL of the user's chosen avatar image.",
257
+ "title": "Avatar Url"
258
+ },
259
+ "bot": {
260
+ "anyOf": [
261
+ {
262
+ "properties": {
263
+ "owner": {
264
+ "anyOf": [
265
+ {
266
+ "properties": {
267
+ "type": {
268
+ "anyOf": [
269
+ {
270
+ "type": "string"
271
+ },
272
+ {
273
+ "type": "null"
274
+ }
275
+ ],
276
+ "default": null,
277
+ "description": "Either 'workspace' or 'user'.",
278
+ "title": "Type"
279
+ }
280
+ },
281
+ "title": "BotOwner",
282
+ "type": "object"
283
+ },
284
+ {
285
+ "type": "null"
286
+ }
287
+ ],
288
+ "default": null,
289
+ "description": "Owner information for the bot."
290
+ },
291
+ "workspace_id": {
292
+ "anyOf": [
293
+ {
294
+ "type": "string"
295
+ },
296
+ {
297
+ "type": "null"
298
+ }
299
+ ],
300
+ "default": null,
301
+ "description": "ID of the bot's workspace.",
302
+ "title": "Workspace Id"
303
+ },
304
+ "workspace_limits": {
305
+ "anyOf": [
306
+ {
307
+ "properties": {
308
+ "max_file_upload_size_in_bytes": {
309
+ "anyOf": [
310
+ {
311
+ "type": "integer"
312
+ },
313
+ {
314
+ "type": "null"
315
+ }
316
+ ],
317
+ "default": null,
318
+ "description": "Maximum file upload size in bytes.",
319
+ "title": "Max File Upload Size In Bytes"
320
+ }
321
+ },
322
+ "title": "WorkspaceLimits",
323
+ "type": "object"
324
+ },
325
+ {
326
+ "type": "null"
327
+ }
328
+ ],
329
+ "default": null,
330
+ "description": "Workspace restrictions for the bot."
331
+ },
332
+ "workspace_name": {
333
+ "anyOf": [
334
+ {
335
+ "type": "string"
336
+ },
337
+ {
338
+ "type": "null"
339
+ }
340
+ ],
341
+ "default": null,
342
+ "description": "Name of the bot's workspace. Null if owner type is 'user'.",
343
+ "title": "Workspace Name"
344
+ }
345
+ },
346
+ "title": "BotDetails",
347
+ "type": "object"
348
+ },
349
+ {
350
+ "type": "null"
351
+ }
352
+ ],
353
+ "default": null,
354
+ "description": "Present when type is 'bot'.",
355
+ "title": "Bot"
356
+ },
357
+ "id": {
358
+ "description": "Unique identifier for the user in UUID format.",
359
+ "title": "Id",
360
+ "type": "string"
361
+ },
362
+ "name": {
363
+ "anyOf": [
364
+ {
365
+ "type": "string"
366
+ },
367
+ {
368
+ "type": "null"
369
+ }
370
+ ],
371
+ "default": null,
372
+ "description": "User's name as displayed in Notion.",
373
+ "title": "Name"
374
+ },
375
+ "object": {
376
+ "description": "Always 'user'.",
377
+ "title": "Object",
378
+ "type": "string"
379
+ },
380
+ "person": {
381
+ "anyOf": [
382
+ {
383
+ "properties": {
384
+ "email": {
385
+ "anyOf": [
386
+ {
387
+ "type": "string"
388
+ },
389
+ {
390
+ "type": "null"
391
+ }
392
+ ],
393
+ "default": null,
394
+ "description": "Email address. Present only if integration has user capability access.",
395
+ "title": "Email"
396
+ }
397
+ },
398
+ "title": "PersonDetails",
399
+ "type": "object"
400
+ },
401
+ {
402
+ "type": "null"
403
+ }
404
+ ],
405
+ "default": null,
406
+ "description": "Present when type is 'person'.",
407
+ "title": "Person"
408
+ },
409
+ "type": {
410
+ "anyOf": [
411
+ {
412
+ "type": "string"
413
+ },
414
+ {
415
+ "type": "null"
416
+ }
417
+ ],
418
+ "default": null,
419
+ "description": "Type of user. Either 'person' or 'bot'.",
420
+ "title": "Type"
421
+ }
422
+ },
423
+ "required": ["object", "id"],
424
+ "title": "Last Edited By",
425
+ "type": "object"
426
+ },
427
+ "last_edited_time": {
428
+ "description": "ISO 8601 timestamp of when the block was last edited.",
429
+ "title": "Last Edited Time",
430
+ "type": "string"
431
+ },
432
+ "object": {
433
+ "description": "Always \"block\".",
434
+ "title": "Object",
435
+ "type": "string"
436
+ },
437
+ "parent": {
438
+ "anyOf": [
439
+ {
440
+ "properties": {
441
+ "database_id": {
442
+ "description": "ID of parent database in UUIDv4 format.",
443
+ "title": "Database Id",
444
+ "type": "string"
445
+ },
446
+ "type": {
447
+ "const": "database_id",
448
+ "description": "Type of parent.",
449
+ "title": "Type",
450
+ "type": "string"
451
+ }
452
+ },
453
+ "required": ["type", "database_id"],
454
+ "title": "DatabaseIdParent",
455
+ "type": "object"
456
+ },
457
+ {
458
+ "properties": {
459
+ "page_id": {
460
+ "description": "ID of parent page in UUIDv4 format.",
461
+ "title": "Page Id",
462
+ "type": "string"
463
+ },
464
+ "type": {
465
+ "const": "page_id",
466
+ "description": "Type of parent.",
467
+ "title": "Type",
468
+ "type": "string"
469
+ }
470
+ },
471
+ "required": ["type", "page_id"],
472
+ "title": "PageIdParent",
473
+ "type": "object"
474
+ },
475
+ {
476
+ "properties": {
477
+ "block_id": {
478
+ "description": "ID of parent block in UUIDv4 format.",
479
+ "title": "Block Id",
480
+ "type": "string"
481
+ },
482
+ "type": {
483
+ "const": "block_id",
484
+ "description": "Type of parent.",
485
+ "title": "Type",
486
+ "type": "string"
487
+ }
488
+ },
489
+ "required": ["type", "block_id"],
490
+ "title": "BlockIdParent",
491
+ "type": "object"
492
+ },
493
+ {
494
+ "properties": {
495
+ "type": {
496
+ "const": "workspace",
497
+ "description": "Type of parent.",
498
+ "title": "Type",
499
+ "type": "string"
500
+ },
501
+ "workspace": {
502
+ "description": "Always true when type is 'workspace'.",
503
+ "title": "Workspace",
504
+ "type": "boolean"
505
+ }
506
+ },
507
+ "required": ["type", "workspace"],
508
+ "title": "WorkspaceParent",
509
+ "type": "object"
510
+ },
511
+ {
512
+ "properties": {
513
+ "data_source_id": {
514
+ "description": "ID of parent data source in UUIDv4 format.",
515
+ "title": "Data Source Id",
516
+ "type": "string"
517
+ },
518
+ "type": {
519
+ "const": "data_source_id",
520
+ "description": "Type of parent.",
521
+ "title": "Type",
522
+ "type": "string"
523
+ }
524
+ },
525
+ "required": ["type", "data_source_id"],
526
+ "title": "DataSourceIdParent",
527
+ "type": "object"
528
+ }
529
+ ],
530
+ "description": "Information about the block's parent container.",
531
+ "title": "Parent"
532
+ },
533
+ "type": {
534
+ "description": "Type of block (e.g., 'paragraph', 'heading_1', 'heading_2', 'heading_3', 'bulleted_list_item', 'numbered_list_item', 'to_do', etc.).",
535
+ "title": "Type",
536
+ "type": "string"
537
+ }
538
+ },
539
+ "required": [
540
+ "object",
541
+ "id",
542
+ "parent",
543
+ "type",
544
+ "created_time",
545
+ "created_by",
546
+ "last_edited_time",
547
+ "last_edited_by",
548
+ "archived",
549
+ "in_trash",
550
+ "has_children"
551
+ ],
552
+ "title": "Data",
553
+ "type": "object"
554
+ },
555
+ "error": {
556
+ "anyOf": [
557
+ {
558
+ "type": "string"
559
+ },
560
+ {
561
+ "type": "null"
562
+ }
563
+ ],
564
+ "default": null,
565
+ "description": "Error if any occurred during the execution of the action",
566
+ "title": "Error"
567
+ },
568
+ "successful": {
569
+ "description": "Whether or not the action execution was successful or not",
570
+ "title": "Successful",
571
+ "type": "boolean"
572
+ }
573
+ },
574
+ "required": ["data", "successful"],
575
+ "title": "DeleteBlockResponseWrapper",
576
+ "type": "object"
577
+ },
578
+ "scopes": ["Read content", "Update content", "Insert content"],
579
+ "tags": ["destructiveHint", "important", "openWorldHint"],
580
+ "no_auth": false,
581
+ "status": "active",
582
+ "is_deprecated": false,
583
+ "deprecated": {
584
+ "displayName": "Delete a block",
585
+ "version": "20260113_00",
586
+ "available_versions": ["20260113_00"],
587
+ "is_deprecated": false,
588
+ "toolkit": {
589
+ "logo": "https://logos.composio.dev/api/notion"
590
+ }
591
+ }
592
+}
ts/packages/cli/test/src/generation/typescript/__snapshots__/generate-type-from-json-schema.test.ts.snap
new
+787
@@ -0,0 +1,787 @@
1
+// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
2
+
3
+exports[`generateTypeFromJsonSchema > control group - simple schemas without discriminator > should generate type for NOTION_ARCHIVE_NOTION_PAGE (two properties) 1`] = `
4
+"type NOTION_ARCHIVE_NOTION_PAGE_INPUT = {
5
+ /**
6
+ * Archive
7
+ * @description Set to \`true\` to move the page to trash (archive), or \`false\` to restore it from trash (unarchive). Defaults to \`true\`.
8
+ * @default true
9
+ */
10
+ archive: boolean;
11
+ /**
12
+ * Page Id
13
+ * @description The unique identifier (UUID) of the Notion page to be archived or unarchived. This must be a page ID, not a database ID. Database IDs cannot be used with this action - databases must be archived using the archive database action instead. Page IDs can be obtained using NOTION_SEARCH_NOTION_PAGE with filter_value='page' or from the 'id' field of page objects returned by other Notion actions.
14
+ */
15
+ page_id?: string;
16
+};"
17
+`;
18
+
19
+exports[`generateTypeFromJsonSchema > control group - simple schemas without discriminator > should generate type for NOTION_CREATE_COMMENT (moderate complexity with nested objects) 1`] = `
20
+"type NOTION_CREATE_COMMENT_INPUT = {
21
+ /**
22
+ * Comment
23
+ * @description Content of the comment as a NotionRichText object or a JSON string. Simplest form: {'content': 'Looks good!'} or {'text': 'Looks good!'} (both 'content' and 'text' are accepted as the field name). Can also be passed as a JSON string: '{"content": "Looks good!"}'. Optional styling fields: bold, italic, link, etc. Do NOT wrap this in a list or use Notion API block JSON.
24
+ */
25
+ comment?: {
26
+ /**
27
+ * Block Property
28
+ * @description The block property of the block to be added. Possible properties are \`paragraph\`, \`heading_1\`, \`heading_2\`, \`heading_3\`, \`callout\`, \`to_do\`, \`toggle\`, \`quote\`, \`bulleted_list_item\`, \`numbered_list_item\`. Other properties possible are \`file\`, \`image\`, \`video\` (link required), and \`divider\` (creates a horizontal divider line, no content required).
29
+ * @default paragraph
30
+ * @enum {string}
31
+ */
32
+ block_property: "paragraph" | "heading_1" | "heading_2" | "heading_3" | "callout" | "to_do" | "toggle" | "quote" | "bulleted_list_item" | "numbered_list_item" | "file" | "image" | "video" | "divider";
33
+ /**
34
+ * Bold
35
+ * @description Indicates if the text is bold.
36
+ * @default false
37
+ */
38
+ bold: boolean;
39
+ /**
40
+ * Code
41
+ * @description Indicates if the text is formatted as code.
42
+ * @default false
43
+ */
44
+ code: boolean;
45
+ /**
46
+ * Color
47
+ * @description The color of the text background or text itself.
48
+ * @default default
49
+ */
50
+ color: string;
51
+ /**
52
+ * Content
53
+ * @description The textual content of the rich text object. ENHANCED: Now automatically parses markdown formatting including bold (**text**), italic (*text*), strikethrough (~~text~~), inline code (\`code\`), and links ([text](url)). Required for paragraph, heading_1, heading_2, heading_3, callout, to_do, toggle, quote.
54
+ * @default null
55
+ */
56
+ content: string | null;
57
+ /**
58
+ * Italic
59
+ * @description Indicates if the text is italic.
60
+ * @default false
61
+ */
62
+ italic: boolean;
63
+ /**
64
+ * Link
65
+ * @description The URL of the rich text object or the file to be uploaded or image/video link
66
+ * @default null
67
+ */
68
+ link: string | null;
69
+ /**
70
+ * Strikethrough
71
+ * @description Indicates if the text has strikethrough.
72
+ * @default false
73
+ */
74
+ strikethrough: boolean;
75
+ /**
76
+ * Underline
77
+ * @description Indicates if the text is underlined.
78
+ * @default false
79
+ */
80
+ underline: boolean;
81
+ };
82
+ /**
83
+ * Discussion Id
84
+ * @description The ID of an existing discussion thread to which the comment will be added. This is required if \`parent_page_id\` is not provided.
85
+ * @default null
86
+ */
87
+ discussion_id: string | null;
88
+ /**
89
+ * Parent Page Id
90
+ * @description The ID of the Notion page where the comment will be added. This is required if \`discussion_id\` is not provided. Page IDs can be obtained using other Notion actions that fetch page details or list pages.
91
+ * @default null
92
+ */
93
+ parent_page_id: string | null;
94
+};"
95
+`;
96
+
97
+exports[`generateTypeFromJsonSchema > control group - simple schemas without discriminator > should generate type for NOTION_DELETE_BLOCK (simple single property) 1`] = `
98
+"type NOTION_DELETE_BLOCK_INPUT = {
99
+ /**
100
+ * Block Id
101
+ * @description Identifier of the block, page, or database to be deleted (archived). Must be a valid Notion block/page/database ID in UUID format (with or without hyphens). To find page IDs and their titles, consider using an action like \`NOTION_FETCH_DATA\`.
102
+ */
103
+ block_id?: string;
104
+};"
105
+`;
106
+
107
+exports[`generateTypeFromJsonSchema > problematic schema - discriminator with $defs references > should generate type for NOTION_APPEND_TEXT_BLOCKS (discriminator with oneOf) 1`] = `
108
+"type NOTION_APPEND_TEXT_BLOCKS_INPUT = {
109
+ /**
110
+ * After
111
+ * @description Optional UUID of an existing child block. New blocks will be inserted after this block.
112
+ * @default null
113
+ */
114
+ after: string | null;
115
+ /**
116
+ * Block Id
117
+ * @description The UUID of the parent block or page to append children to.
118
+ */
119
+ block_id?: string;
120
+ /**
121
+ * Children
122
+ * @description Array of text block objects to append (also accepts 'blocks' as parameter name). Supported types:
123
+ * - paragraph: Regular text paragraph
124
+ * - heading_1, heading_2, heading_3: Section headings
125
+ * - bulleted_list_item: Bullet point
126
+ * - numbered_list_item: Numbered list item
127
+ *
128
+ * ⚠️ Text content limited to 2000 characters per rich_text text.content field.
129
+ * Max 100 blocks per request.
130
+ */
131
+ children?: ({
132
+ /**
133
+ * Object
134
+ * @description Always 'block'.
135
+ * @default block
136
+ * @constant
137
+ */
138
+ object: "block";
139
+ /**
140
+ * ParagraphInput
141
+ * @description Paragraph content.
142
+ */
143
+ paragraph: {
144
+ /**
145
+ * BlockColor
146
+ * @description Color of the paragraph text or background.
147
+ * @default default
148
+ * @enum {string}
149
+ */
150
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
151
+ /**
152
+ * Rich Text
153
+ * @description Array of rich text objects. Each text.content is limited to 2000 chars.
154
+ */
155
+ rich_text: {
156
+ /**
157
+ * @description Optional text styling annotations (bold, italic, etc.).
158
+ * @default null
159
+ */
160
+ annotations: {
161
+ /**
162
+ * Bold
163
+ * @description Whether the text is bold.
164
+ * @default false
165
+ */
166
+ bold: boolean;
167
+ /**
168
+ * Code
169
+ * @description Whether the text is formatted as inline code.
170
+ * @default false
171
+ */
172
+ code: boolean;
173
+ /**
174
+ * BlockColor
175
+ * @description Color of the text or background.
176
+ * @default default
177
+ * @enum {string}
178
+ */
179
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
180
+ /**
181
+ * Italic
182
+ * @description Whether the text is italic.
183
+ * @default false
184
+ */
185
+ italic: boolean;
186
+ /**
187
+ * Strikethrough
188
+ * @description Whether the text has strikethrough.
189
+ * @default false
190
+ */
191
+ strikethrough: boolean;
192
+ /**
193
+ * Underline
194
+ * @description Whether the text is underlined.
195
+ * @default false
196
+ */
197
+ underline: boolean;
198
+ } | null;
199
+ /**
200
+ * TextContent
201
+ * @description The text content object.
202
+ */
203
+ text: {
204
+ /**
205
+ * Content
206
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
207
+ */
208
+ content: string;
209
+ /**
210
+ * @description Optional link for the text.
211
+ * @default null
212
+ */
213
+ link: {
214
+ /**
215
+ * Url
216
+ * @description The URL the text links to.
217
+ */
218
+ url: string;
219
+ } | null;
220
+ };
221
+ /**
222
+ * Type
223
+ * @description Type of rich text. Currently only 'text' is supported for input.
224
+ * @default text
225
+ * @constant
226
+ */
227
+ type: "text";
228
+ }[];
229
+ };
230
+ /**
231
+ * Type
232
+ * @description Block type.
233
+ * @default paragraph
234
+ * @constant
235
+ */
236
+ type: "paragraph";
237
+ } | {
238
+ /**
239
+ * HeadingInput
240
+ * @description Heading 1 content.
241
+ */
242
+ heading_1: {
243
+ /**
244
+ * BlockColor
245
+ * @description Color of the heading.
246
+ * @default default
247
+ * @enum {string}
248
+ */
249
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
250
+ /**
251
+ * Is Toggleable
252
+ * @description Whether the heading can be toggled to show/hide content.
253
+ * @default false
254
+ */
255
+ is_toggleable: boolean;
256
+ /**
257
+ * Rich Text
258
+ * @description Array of rich text objects for the heading text.
259
+ */
260
+ rich_text: {
261
+ /**
262
+ * @description Optional text styling annotations (bold, italic, etc.).
263
+ * @default null
264
+ */
265
+ annotations: {
266
+ /**
267
+ * Bold
268
+ * @description Whether the text is bold.
269
+ * @default false
270
+ */
271
+ bold: boolean;
272
+ /**
273
+ * Code
274
+ * @description Whether the text is formatted as inline code.
275
+ * @default false
276
+ */
277
+ code: boolean;
278
+ /**
279
+ * BlockColor
280
+ * @description Color of the text or background.
281
+ * @default default
282
+ * @enum {string}
283
+ */
284
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
285
+ /**
286
+ * Italic
287
+ * @description Whether the text is italic.
288
+ * @default false
289
+ */
290
+ italic: boolean;
291
+ /**
292
+ * Strikethrough
293
+ * @description Whether the text has strikethrough.
294
+ * @default false
295
+ */
296
+ strikethrough: boolean;
297
+ /**
298
+ * Underline
299
+ * @description Whether the text is underlined.
300
+ * @default false
301
+ */
302
+ underline: boolean;
303
+ } | null;
304
+ /**
305
+ * TextContent
306
+ * @description The text content object.
307
+ */
308
+ text: {
309
+ /**
310
+ * Content
311
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
312
+ */
313
+ content: string;
314
+ /**
315
+ * @description Optional link for the text.
316
+ * @default null
317
+ */
318
+ link: {
319
+ /**
320
+ * Url
321
+ * @description The URL the text links to.
322
+ */
323
+ url: string;
324
+ } | null;
325
+ };
326
+ /**
327
+ * Type
328
+ * @description Type of rich text. Currently only 'text' is supported for input.
329
+ * @default text
330
+ * @constant
331
+ */
332
+ type: "text";
333
+ }[];
334
+ };
335
+ /**
336
+ * Object
337
+ * @description Always 'block'.
338
+ * @default block
339
+ * @constant
340
+ */
341
+ object: "block";
342
+ /**
343
+ * Type
344
+ * @description Block type.
345
+ * @default heading_1
346
+ * @constant
347
+ */
348
+ type: "heading_1";
349
+ } | {
350
+ /**
351
+ * HeadingInput
352
+ * @description Heading 2 content.
353
+ */
354
+ heading_2: {
355
+ /**
356
+ * BlockColor
357
+ * @description Color of the heading.
358
+ * @default default
359
+ * @enum {string}
360
+ */
361
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
362
+ /**
363
+ * Is Toggleable
364
+ * @description Whether the heading can be toggled to show/hide content.
365
+ * @default false
366
+ */
367
+ is_toggleable: boolean;
368
+ /**
369
+ * Rich Text
370
+ * @description Array of rich text objects for the heading text.
371
+ */
372
+ rich_text: {
373
+ /**
374
+ * @description Optional text styling annotations (bold, italic, etc.).
375
+ * @default null
376
+ */
377
+ annotations: {
378
+ /**
379
+ * Bold
380
+ * @description Whether the text is bold.
381
+ * @default false
382
+ */
383
+ bold: boolean;
384
+ /**
385
+ * Code
386
+ * @description Whether the text is formatted as inline code.
387
+ * @default false
388
+ */
389
+ code: boolean;
390
+ /**
391
+ * BlockColor
392
+ * @description Color of the text or background.
393
+ * @default default
394
+ * @enum {string}
395
+ */
396
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
397
+ /**
398
+ * Italic
399
+ * @description Whether the text is italic.
400
+ * @default false
401
+ */
402
+ italic: boolean;
403
+ /**
404
+ * Strikethrough
405
+ * @description Whether the text has strikethrough.
406
+ * @default false
407
+ */
408
+ strikethrough: boolean;
409
+ /**
410
+ * Underline
411
+ * @description Whether the text is underlined.
412
+ * @default false
413
+ */
414
+ underline: boolean;
415
+ } | null;
416
+ /**
417
+ * TextContent
418
+ * @description The text content object.
419
+ */
420
+ text: {
421
+ /**
422
+ * Content
423
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
424
+ */
425
+ content: string;
426
+ /**
427
+ * @description Optional link for the text.
428
+ * @default null
429
+ */
430
+ link: {
431
+ /**
432
+ * Url
433
+ * @description The URL the text links to.
434
+ */
435
+ url: string;
436
+ } | null;
437
+ };
438
+ /**
439
+ * Type
440
+ * @description Type of rich text. Currently only 'text' is supported for input.
441
+ * @default text
442
+ * @constant
443
+ */
444
+ type: "text";
445
+ }[];
446
+ };
447
+ /**
448
+ * Object
449
+ * @description Always 'block'.
450
+ * @default block
451
+ * @constant
452
+ */
453
+ object: "block";
454
+ /**
455
+ * Type
456
+ * @description Block type.
457
+ * @default heading_2
458
+ * @constant
459
+ */
460
+ type: "heading_2";
461
+ } | {
462
+ /**
463
+ * HeadingInput
464
+ * @description Heading 3 content.
465
+ */
466
+ heading_3: {
467
+ /**
468
+ * BlockColor
469
+ * @description Color of the heading.
470
+ * @default default
471
+ * @enum {string}
472
+ */
473
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
474
+ /**
475
+ * Is Toggleable
476
+ * @description Whether the heading can be toggled to show/hide content.
477
+ * @default false
478
+ */
479
+ is_toggleable: boolean;
480
+ /**
481
+ * Rich Text
482
+ * @description Array of rich text objects for the heading text.
483
+ */
484
+ rich_text: {
485
+ /**
486
+ * @description Optional text styling annotations (bold, italic, etc.).
487
+ * @default null
488
+ */
489
+ annotations: {
490
+ /**
491
+ * Bold
492
+ * @description Whether the text is bold.
493
+ * @default false
494
+ */
495
+ bold: boolean;
496
+ /**
497
+ * Code
498
+ * @description Whether the text is formatted as inline code.
499
+ * @default false
500
+ */
501
+ code: boolean;
502
+ /**
503
+ * BlockColor
504
+ * @description Color of the text or background.
505
+ * @default default
506
+ * @enum {string}
507
+ */
508
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
509
+ /**
510
+ * Italic
511
+ * @description Whether the text is italic.
512
+ * @default false
513
+ */
514
+ italic: boolean;
515
+ /**
516
+ * Strikethrough
517
+ * @description Whether the text has strikethrough.
518
+ * @default false
519
+ */
520
+ strikethrough: boolean;
521
+ /**
522
+ * Underline
523
+ * @description Whether the text is underlined.
524
+ * @default false
525
+ */
526
+ underline: boolean;
527
+ } | null;
528
+ /**
529
+ * TextContent
530
+ * @description The text content object.
531
+ */
532
+ text: {
533
+ /**
534
+ * Content
535
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
536
+ */
537
+ content: string;
538
+ /**
539
+ * @description Optional link for the text.
540
+ * @default null
541
+ */
542
+ link: {
543
+ /**
544
+ * Url
545
+ * @description The URL the text links to.
546
+ */
547
+ url: string;
548
+ } | null;
549
+ };
550
+ /**
551
+ * Type
552
+ * @description Type of rich text. Currently only 'text' is supported for input.
553
+ * @default text
554
+ * @constant
555
+ */
556
+ type: "text";
557
+ }[];
558
+ };
559
+ /**
560
+ * Object
561
+ * @description Always 'block'.
562
+ * @default block
563
+ * @constant
564
+ */
565
+ object: "block";
566
+ /**
567
+ * Type
568
+ * @description Block type.
569
+ * @default heading_3
570
+ * @constant
571
+ */
572
+ type: "heading_3";
573
+ } | {
574
+ /**
575
+ * ListItemInput
576
+ * @description Bulleted list item content.
577
+ */
578
+ bulleted_list_item: {
579
+ /**
580
+ * BlockColor
581
+ * @description Color of the list item.
582
+ * @default default
583
+ * @enum {string}
584
+ */
585
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
586
+ /**
587
+ * Rich Text
588
+ * @description Array of rich text objects for the list item text.
589
+ */
590
+ rich_text: {
591
+ /**
592
+ * @description Optional text styling annotations (bold, italic, etc.).
593
+ * @default null
594
+ */
595
+ annotations: {
596
+ /**
597
+ * Bold
598
+ * @description Whether the text is bold.
599
+ * @default false
600
+ */
601
+ bold: boolean;
602
+ /**
603
+ * Code
604
+ * @description Whether the text is formatted as inline code.
605
+ * @default false
606
+ */
607
+ code: boolean;
608
+ /**
609
+ * BlockColor
610
+ * @description Color of the text or background.
611
+ * @default default
612
+ * @enum {string}
613
+ */
614
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
615
+ /**
616
+ * Italic
617
+ * @description Whether the text is italic.
618
+ * @default false
619
+ */
620
+ italic: boolean;
621
+ /**
622
+ * Strikethrough
623
+ * @description Whether the text has strikethrough.
624
+ * @default false
625
+ */
626
+ strikethrough: boolean;
627
+ /**
628
+ * Underline
629
+ * @description Whether the text is underlined.
630
+ * @default false
631
+ */
632
+ underline: boolean;
633
+ } | null;
634
+ /**
635
+ * TextContent
636
+ * @description The text content object.
637
+ */
638
+ text: {
639
+ /**
640
+ * Content
641
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
642
+ */
643
+ content: string;
644
+ /**
645
+ * @description Optional link for the text.
646
+ * @default null
647
+ */
648
+ link: {
649
+ /**
650
+ * Url
651
+ * @description The URL the text links to.
652
+ */
653
+ url: string;
654
+ } | null;
655
+ };
656
+ /**
657
+ * Type
658
+ * @description Type of rich text. Currently only 'text' is supported for input.
659
+ * @default text
660
+ * @constant
661
+ */
662
+ type: "text";
663
+ }[];
664
+ };
665
+ /**
666
+ * Object
667
+ * @description Always 'block'.
668
+ * @default block
669
+ * @constant
670
+ */
671
+ object: "block";
672
+ /**
673
+ * Type
674
+ * @description Block type.
675
+ * @default bulleted_list_item
676
+ * @constant
677
+ */
678
+ type: "bulleted_list_item";
679
+ } | {
680
+ /**
681
+ * ListItemInput
682
+ * @description Numbered list item content.
683
+ */
684
+ numbered_list_item: {
685
+ /**
686
+ * BlockColor
687
+ * @description Color of the list item.
688
+ * @default default
689
+ * @enum {string}
690
+ */
691
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
692
+ /**
693
+ * Rich Text
694
+ * @description Array of rich text objects for the list item text.
695
+ */
696
+ rich_text: {
697
+ /**
698
+ * @description Optional text styling annotations (bold, italic, etc.).
699
+ * @default null
700
+ */
701
+ annotations: {
702
+ /**
703
+ * Bold
704
+ * @description Whether the text is bold.
705
+ * @default false
706
+ */
707
+ bold: boolean;
708
+ /**
709
+ * Code
710
+ * @description Whether the text is formatted as inline code.
711
+ * @default false
712
+ */
713
+ code: boolean;
714
+ /**
715
+ * BlockColor
716
+ * @description Color of the text or background.
717
+ * @default default
718
+ * @enum {string}
719
+ */
720
+ color: "default" | "gray" | "brown" | "orange" | "yellow" | "green" | "blue" | "purple" | "pink" | "red" | "gray_background" | "brown_background" | "orange_background" | "yellow_background" | "green_background" | "blue_background" | "purple_background" | "pink_background" | "red_background";
721
+ /**
722
+ * Italic
723
+ * @description Whether the text is italic.
724
+ * @default false
725
+ */
726
+ italic: boolean;
727
+ /**
728
+ * Strikethrough
729
+ * @description Whether the text has strikethrough.
730
+ * @default false
731
+ */
732
+ strikethrough: boolean;
733
+ /**
734
+ * Underline
735
+ * @description Whether the text is underlined.
736
+ * @default false
737
+ */
738
+ underline: boolean;
739
+ } | null;
740
+ /**
741
+ * TextContent
742
+ * @description The text content object.
743
+ */
744
+ text: {
745
+ /**
746
+ * Content
747
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
748
+ */
749
+ content: string;
750
+ /**
751
+ * @description Optional link for the text.
752
+ * @default null
753
+ */
754
+ link: {
755
+ /**
756
+ * Url
757
+ * @description The URL the text links to.
758
+ */
759
+ url: string;
760
+ } | null;
761
+ };
762
+ /**
763
+ * Type
764
+ * @description Type of rich text. Currently only 'text' is supported for input.
765
+ * @default text
766
+ * @constant
767
+ */
768
+ type: "text";
769
+ }[];
770
+ };
771
+ /**
772
+ * Object
773
+ * @description Always 'block'.
774
+ * @default block
775
+ * @constant
776
+ */
777
+ object: "block";
778
+ /**
779
+ * Type
780
+ * @description Block type.
781
+ * @default numbered_list_item
782
+ * @constant
783
+ */
784
+ type: "numbered_list_item";
785
+ })[];
786
+};"
787
+`;
ts/packages/cli/test/src/generation/typescript/generate-type-from-json-schema.test.ts
new
+78
@@ -0,0 +1,78 @@
1
+import { describe, expect, it } from '@effect/vitest';
2
+import { Effect } from 'effect';
3
+import { generateTypeFromJsonSchema } from 'src/generation/typescript/generate-type-from-json-schema';
4
+import { assertTypeScriptIsValid } from 'test/__utils__/typescript-compiler';
5
+
6
+// Import fixtures
7
+import notionDeleteBlock from 'test/__fixtures__/notion-delete-block.json';
8
+import notionArchivePage from 'test/__fixtures__/notion-archive-page.json';
9
+import notionCreateComment from 'test/__fixtures__/notion-create-comment.json';
10
+import notionAppendTextBlocks from 'test/__fixtures__/notion-append-text-blocks.json';
11
+
12
+describe('generateTypeFromJsonSchema', () => {
13
+ describe('control group - simple schemas without discriminator', () => {
14
+ it.effect(
15
+ 'should generate type for NOTION_DELETE_BLOCK (simple single property)',
16
+ Effect.fn(function* () {
17
+ const result = yield* generateTypeFromJsonSchema(
18
+ 'NOTION_DELETE_BLOCK_INPUT',
19
+ notionDeleteBlock.input_parameters
20
+ );
21
+
22
+ expect(result).toContain('type NOTION_DELETE_BLOCK_INPUT');
23
+ expect(result).toContain('block_id');
24
+ expect(result).toMatchSnapshot();
25
+ assertTypeScriptIsValid({ files: { 'index.ts': result } });
26
+ })
27
+ );
28
+
29
+ it.effect(
30
+ 'should generate type for NOTION_ARCHIVE_NOTION_PAGE (two properties)',
31
+ Effect.fn(function* () {
32
+ const result = yield* generateTypeFromJsonSchema(
33
+ 'NOTION_ARCHIVE_NOTION_PAGE_INPUT',
34
+ notionArchivePage.input_parameters
35
+ );
36
+
37
+ expect(result).toContain('type NOTION_ARCHIVE_NOTION_PAGE_INPUT');
38
+ expect(result).toContain('page_id');
39
+ expect(result).toContain('archive');
40
+ expect(result).toMatchSnapshot();
41
+ assertTypeScriptIsValid({ files: { 'index.ts': result } });
42
+ })
43
+ );
44
+
45
+ it.effect(
46
+ 'should generate type for NOTION_CREATE_COMMENT (moderate complexity with nested objects)',
47
+ Effect.fn(function* () {
48
+ const result = yield* generateTypeFromJsonSchema(
49
+ 'NOTION_CREATE_COMMENT_INPUT',
50
+ notionCreateComment.input_parameters
51
+ );
52
+
53
+ expect(result).toContain('type NOTION_CREATE_COMMENT_INPUT');
54
+ expect(result).toContain('comment');
55
+ expect(result).toMatchSnapshot();
56
+ assertTypeScriptIsValid({ files: { 'index.ts': result } });
57
+ })
58
+ );
59
+ });
60
+
61
+ describe('problematic schema - discriminator with $defs references', () => {
62
+ it.effect(
63
+ 'should generate type for NOTION_APPEND_TEXT_BLOCKS (discriminator with oneOf)',
64
+ Effect.fn(function* () {
65
+ const result = yield* generateTypeFromJsonSchema(
66
+ 'NOTION_APPEND_TEXT_BLOCKS_INPUT',
67
+ notionAppendTextBlocks.input_parameters
68
+ );
69
+
70
+ expect(result).toContain('type NOTION_APPEND_TEXT_BLOCKS_INPUT');
71
+ expect(result).toContain('block_id');
72
+ expect(result).toContain('children');
73
+ expect(result).toMatchSnapshot();
74
+ assertTypeScriptIsValid({ files: { 'index.ts': result } });
75
+ })
76
+ );
77
+ });
78
+});