Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix(ts/cli): fix generateTypeFromJsonSchema, allowing $def in input/output schemas

jkomyno354c007fb995
diff --git a/ts/packages/cli/src/generation/typescript/generate-type-from-json-schema.ts b/ts/packages/cli/src/generation/typescript/generate-type-from-json-schema.ts
index aacb4c73e..9c458d9db 100644
--- a/ts/packages/cli/src/generation/typescript/generate-type-from-json-schema.ts
+++ b/ts/packages/cli/src/generation/typescript/generate-type-from-json-schema.ts
@@ -12,13 +12,19 @@ export function generateTypeFromJsonSchema(
name: string,
schema: { readonly [x: string]: unknown }
) {
+ // Preprocess the schema to remove discriminator objects that reference non-existent $defs.
+ // The Composio API returns schemas with discriminator.mapping that point to #/$defs/... paths,
+ // but the actual types are inlined in oneOf/anyOf arrays. openapi-typescript can handle
+ // oneOf/anyOf without discriminator, so we simply remove it.
+ const processedProperties = removeDiscriminators(schema['properties']);
+
const openApi3Definition = {
openapi: '3.1.0',
components: {
schemas: {
[name]: {
type: 'object',
- properties: schema['properties'],
+ properties: processedProperties,
},
},
},
@@ -140,3 +146,30 @@ export function generateTypeFromJsonSchema(
function isInterfaceComponents(node: ts.Node): node is ts.InterfaceDeclaration {
return ts.isInterfaceDeclaration(node) && node.name.escapedText === 'components';
}
+
+/**
+ * Recursively removes `discriminator` objects from a JSON schema.
+ * This is needed because Composio's API returns schemas with discriminator.mapping
+ * that reference #/$defs/... paths, but the types are inlined in oneOf/anyOf arrays
+ * rather than defined in a $defs section. openapi-typescript fails to resolve these refs.
+ * Since oneOf/anyOf work fine without discriminator, we simply remove it.
+ */
+function removeDiscriminators(obj: unknown): unknown {
+ if (obj === null || typeof obj !== 'object') {
+ return obj;
+ }
+
+ if (Array.isArray(obj)) {
+ return obj.map(removeDiscriminators);
+ }
+
+ const result: Record<string, unknown> = {};
+ for (const [key, value] of Object.entries(obj)) {
+ if (key === 'discriminator') {
+ // Skip discriminator objects entirely
+ continue;
+ }
+ result[key] = removeDiscriminators(value);
+ }
+ return result;
+}
diff --git a/ts/packages/cli/test/__fixtures__/notion-append-text-blocks.json b/ts/packages/cli/test/__fixtures__/notion-append-text-blocks.json
new file mode 100644
index 000000000..bacabcb36
--- /dev/null
+++ b/ts/packages/cli/test/__fixtures__/notion-append-text-blocks.json
@@ -0,0 +1,1563 @@
+{
+ "slug": "NOTION_APPEND_TEXT_BLOCKS",
+ "name": "Append text blocks (paragraphs, headings, lists)",
+ "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",
+ "available_versions": ["20260113_00"],
+ "version": "20260113_00",
+ "toolkit": {
+ "slug": "notion",
+ "name": "notion",
+ "logo": "https://logos.composio.dev/api/notion"
+ },
+ "input_parameters": {
+ "description": "Request model for appending text blocks to a Notion page.",
+ "properties": {
+ "after": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional UUID of an existing child block. New blocks will be inserted after this block.",
+ "examples": ["9bc30ad4-9373-46a5-84ab-0a7845ee52e6"],
+ "title": "After"
+ },
+ "block_id": {
+ "description": "The UUID of the parent block or page to append children to.",
+ "examples": ["b55c9c91-384d-452b-81db-d1ef79372b75", "b55c9c91384d452b81dbd1ef79372b75"],
+ "title": "Block Id",
+ "type": "string"
+ },
+ "children": {
+ "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.",
+ "examples": [
+ [
+ {
+ "heading_2": {
+ "rich_text": [
+ {
+ "text": {
+ "content": "Section Title"
+ },
+ "type": "text"
+ }
+ ]
+ },
+ "object": "block",
+ "type": "heading_2"
+ }
+ ],
+ [
+ {
+ "object": "block",
+ "paragraph": {
+ "rich_text": [
+ {
+ "text": {
+ "content": "This is a paragraph."
+ },
+ "type": "text"
+ }
+ ]
+ },
+ "type": "paragraph"
+ }
+ ]
+ ],
+ "items": {
+ "discriminator": {
+ "mapping": {
+ "bulleted_list_item": "#/$defs/BulletedListItemBlockInput",
+ "heading_1": "#/$defs/Heading1BlockInput",
+ "heading_2": "#/$defs/Heading2BlockInput",
+ "heading_3": "#/$defs/Heading3BlockInput",
+ "numbered_list_item": "#/$defs/NumberedListItemBlockInput",
+ "paragraph": "#/$defs/ParagraphBlockInput"
+ },
+ "propertyName": "type"
+ },
+ "oneOf": [
+ {
+ "description": "A paragraph block object.",
+ "properties": {
+ "object": {
+ "const": "block",
+ "default": "block",
+ "description": "Always 'block'.",
+ "title": "Object",
+ "type": "string"
+ },
+ "paragraph": {
+ "description": "Paragraph content.",
+ "properties": {
+ "color": {
+ "default": "default",
+ "description": "Color of the paragraph text or background.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "rich_text": {
+ "description": "Array of rich text objects. Each text.content is limited to 2000 chars.",
+ "items": {
+ "description": "Rich text object for creating text content in blocks.",
+ "properties": {
+ "annotations": {
+ "anyOf": [
+ {
+ "description": "Text styling annotations for rich text.",
+ "properties": {
+ "bold": {
+ "default": false,
+ "description": "Whether the text is bold.",
+ "title": "Bold",
+ "type": "boolean"
+ },
+ "code": {
+ "default": false,
+ "description": "Whether the text is formatted as inline code.",
+ "title": "Code",
+ "type": "boolean"
+ },
+ "color": {
+ "default": "default",
+ "description": "Color of the text or background.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "italic": {
+ "default": false,
+ "description": "Whether the text is italic.",
+ "title": "Italic",
+ "type": "boolean"
+ },
+ "strikethrough": {
+ "default": false,
+ "description": "Whether the text has strikethrough.",
+ "title": "Strikethrough",
+ "type": "boolean"
+ },
+ "underline": {
+ "default": false,
+ "description": "Whether the text is underlined.",
+ "title": "Underline",
+ "type": "boolean"
+ }
+ },
+ "title": "TextAnnotations",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional text styling annotations (bold, italic, etc.)."
+ },
+ "text": {
+ "description": "The text content object.",
+ "properties": {
+ "content": {
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
+ "examples": ["Hello, World!", "This is a paragraph of text."],
+ "maxLength": 2000,
+ "title": "Content",
+ "type": "string"
+ },
+ "link": {
+ "anyOf": [
+ {
+ "description": "Link object for hyperlinked text.",
+ "properties": {
+ "url": {
+ "description": "The URL the text links to.",
+ "examples": [
+ "https://www.notion.so",
+ "https://example.com"
+ ],
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url"],
+ "title": "TextLink",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional link for the text."
+ }
+ },
+ "required": ["content"],
+ "title": "TextContent",
+ "type": "object"
+ },
+ "type": {
+ "const": "text",
+ "default": "text",
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["text"],
+ "title": "RichTextInput",
+ "type": "object"
+ },
+ "minItems": 1,
+ "title": "Rich Text",
+ "type": "array"
+ }
+ },
+ "required": ["rich_text"],
+ "title": "ParagraphInput",
+ "type": "object"
+ },
+ "type": {
+ "const": "paragraph",
+ "default": "paragraph",
+ "description": "Block type.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["paragraph"],
+ "title": "ParagraphBlockInput",
+ "type": "object"
+ },
+ {
+ "description": "A heading 1 block object (largest heading).",
+ "properties": {
+ "heading_1": {
+ "description": "Heading 1 content.",
+ "properties": {
+ "color": {
+ "default": "default",
+ "description": "Color of the heading.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "is_toggleable": {
+ "default": false,
+ "description": "Whether the heading can be toggled to show/hide content.",
+ "title": "Is Toggleable",
+ "type": "boolean"
+ },
+ "rich_text": {
+ "description": "Array of rich text objects for the heading text.",
+ "items": {
+ "description": "Rich text object for creating text content in blocks.",
+ "properties": {
+ "annotations": {
+ "anyOf": [
+ {
+ "description": "Text styling annotations for rich text.",
+ "properties": {
+ "bold": {
+ "default": false,
+ "description": "Whether the text is bold.",
+ "title": "Bold",
+ "type": "boolean"
+ },
+ "code": {
+ "default": false,
+ "description": "Whether the text is formatted as inline code.",
+ "title": "Code",
+ "type": "boolean"
+ },
+ "color": {
+ "default": "default",
+ "description": "Color of the text or background.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "italic": {
+ "default": false,
+ "description": "Whether the text is italic.",
+ "title": "Italic",
+ "type": "boolean"
+ },
+ "strikethrough": {
+ "default": false,
+ "description": "Whether the text has strikethrough.",
+ "title": "Strikethrough",
+ "type": "boolean"
+ },
+ "underline": {
+ "default": false,
+ "description": "Whether the text is underlined.",
+ "title": "Underline",
+ "type": "boolean"
+ }
+ },
+ "title": "TextAnnotations",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional text styling annotations (bold, italic, etc.)."
+ },
+ "text": {
+ "description": "The text content object.",
+ "properties": {
+ "content": {
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
+ "examples": ["Hello, World!", "This is a paragraph of text."],
+ "maxLength": 2000,
+ "title": "Content",
+ "type": "string"
+ },
+ "link": {
+ "anyOf": [
+ {
+ "description": "Link object for hyperlinked text.",
+ "properties": {
+ "url": {
+ "description": "The URL the text links to.",
+ "examples": [
+ "https://www.notion.so",
+ "https://example.com"
+ ],
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url"],
+ "title": "TextLink",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional link for the text."
+ }
+ },
+ "required": ["content"],
+ "title": "TextContent",
+ "type": "object"
+ },
+ "type": {
+ "const": "text",
+ "default": "text",
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["text"],
+ "title": "RichTextInput",
+ "type": "object"
+ },
+ "minItems": 1,
+ "title": "Rich Text",
+ "type": "array"
+ }
+ },
+ "required": ["rich_text"],
+ "title": "HeadingInput",
+ "type": "object"
+ },
+ "object": {
+ "const": "block",
+ "default": "block",
+ "description": "Always 'block'.",
+ "title": "Object",
+ "type": "string"
+ },
+ "type": {
+ "const": "heading_1",
+ "default": "heading_1",
+ "description": "Block type.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["heading_1"],
+ "title": "Heading1BlockInput",
+ "type": "object"
+ },
+ {
+ "description": "A heading 2 block object (medium heading).",
+ "properties": {
+ "heading_2": {
+ "description": "Heading 2 content.",
+ "properties": {
+ "color": {
+ "default": "default",
+ "description": "Color of the heading.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "is_toggleable": {
+ "default": false,
+ "description": "Whether the heading can be toggled to show/hide content.",
+ "title": "Is Toggleable",
+ "type": "boolean"
+ },
+ "rich_text": {
+ "description": "Array of rich text objects for the heading text.",
+ "items": {
+ "description": "Rich text object for creating text content in blocks.",
+ "properties": {
+ "annotations": {
+ "anyOf": [
+ {
+ "description": "Text styling annotations for rich text.",
+ "properties": {
+ "bold": {
+ "default": false,
+ "description": "Whether the text is bold.",
+ "title": "Bold",
+ "type": "boolean"
+ },
+ "code": {
+ "default": false,
+ "description": "Whether the text is formatted as inline code.",
+ "title": "Code",
+ "type": "boolean"
+ },
+ "color": {
+ "default": "default",
+ "description": "Color of the text or background.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "italic": {
+ "default": false,
+ "description": "Whether the text is italic.",
+ "title": "Italic",
+ "type": "boolean"
+ },
+ "strikethrough": {
+ "default": false,
+ "description": "Whether the text has strikethrough.",
+ "title": "Strikethrough",
+ "type": "boolean"
+ },
+ "underline": {
+ "default": false,
+ "description": "Whether the text is underlined.",
+ "title": "Underline",
+ "type": "boolean"
+ }
+ },
+ "title": "TextAnnotations",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional text styling annotations (bold, italic, etc.)."
+ },
+ "text": {
+ "description": "The text content object.",
+ "properties": {
+ "content": {
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
+ "examples": ["Hello, World!", "This is a paragraph of text."],
+ "maxLength": 2000,
+ "title": "Content",
+ "type": "string"
+ },
+ "link": {
+ "anyOf": [
+ {
+ "description": "Link object for hyperlinked text.",
+ "properties": {
+ "url": {
+ "description": "The URL the text links to.",
+ "examples": [
+ "https://www.notion.so",
+ "https://example.com"
+ ],
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url"],
+ "title": "TextLink",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional link for the text."
+ }
+ },
+ "required": ["content"],
+ "title": "TextContent",
+ "type": "object"
+ },
+ "type": {
+ "const": "text",
+ "default": "text",
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["text"],
+ "title": "RichTextInput",
+ "type": "object"
+ },
+ "minItems": 1,
+ "title": "Rich Text",
+ "type": "array"
+ }
+ },
+ "required": ["rich_text"],
+ "title": "HeadingInput",
+ "type": "object"
+ },
+ "object": {
+ "const": "block",
+ "default": "block",
+ "description": "Always 'block'.",
+ "title": "Object",
+ "type": "string"
+ },
+ "type": {
+ "const": "heading_2",
+ "default": "heading_2",
+ "description": "Block type.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["heading_2"],
+ "title": "Heading2BlockInput",
+ "type": "object"
+ },
+ {
+ "description": "A heading 3 block object (smallest heading).",
+ "properties": {
+ "heading_3": {
+ "description": "Heading 3 content.",
+ "properties": {
+ "color": {
+ "default": "default",
+ "description": "Color of the heading.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "is_toggleable": {
+ "default": false,
+ "description": "Whether the heading can be toggled to show/hide content.",
+ "title": "Is Toggleable",
+ "type": "boolean"
+ },
+ "rich_text": {
+ "description": "Array of rich text objects for the heading text.",
+ "items": {
+ "description": "Rich text object for creating text content in blocks.",
+ "properties": {
+ "annotations": {
+ "anyOf": [
+ {
+ "description": "Text styling annotations for rich text.",
+ "properties": {
+ "bold": {
+ "default": false,
+ "description": "Whether the text is bold.",
+ "title": "Bold",
+ "type": "boolean"
+ },
+ "code": {
+ "default": false,
+ "description": "Whether the text is formatted as inline code.",
+ "title": "Code",
+ "type": "boolean"
+ },
+ "color": {
+ "default": "default",
+ "description": "Color of the text or background.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "italic": {
+ "default": false,
+ "description": "Whether the text is italic.",
+ "title": "Italic",
+ "type": "boolean"
+ },
+ "strikethrough": {
+ "default": false,
+ "description": "Whether the text has strikethrough.",
+ "title": "Strikethrough",
+ "type": "boolean"
+ },
+ "underline": {
+ "default": false,
+ "description": "Whether the text is underlined.",
+ "title": "Underline",
+ "type": "boolean"
+ }
+ },
+ "title": "TextAnnotations",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional text styling annotations (bold, italic, etc.)."
+ },
+ "text": {
+ "description": "The text content object.",
+ "properties": {
+ "content": {
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
+ "examples": ["Hello, World!", "This is a paragraph of text."],
+ "maxLength": 2000,
+ "title": "Content",
+ "type": "string"
+ },
+ "link": {
+ "anyOf": [
+ {
+ "description": "Link object for hyperlinked text.",
+ "properties": {
+ "url": {
+ "description": "The URL the text links to.",
+ "examples": [
+ "https://www.notion.so",
+ "https://example.com"
+ ],
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url"],
+ "title": "TextLink",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional link for the text."
+ }
+ },
+ "required": ["content"],
+ "title": "TextContent",
+ "type": "object"
+ },
+ "type": {
+ "const": "text",
+ "default": "text",
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["text"],
+ "title": "RichTextInput",
+ "type": "object"
+ },
+ "minItems": 1,
+ "title": "Rich Text",
+ "type": "array"
+ }
+ },
+ "required": ["rich_text"],
+ "title": "HeadingInput",
+ "type": "object"
+ },
+ "object": {
+ "const": "block",
+ "default": "block",
+ "description": "Always 'block'.",
+ "title": "Object",
+ "type": "string"
+ },
+ "type": {
+ "const": "heading_3",
+ "default": "heading_3",
+ "description": "Block type.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["heading_3"],
+ "title": "Heading3BlockInput",
+ "type": "object"
+ },
+ {
+ "description": "A bulleted list item block object.",
+ "properties": {
+ "bulleted_list_item": {
+ "description": "Bulleted list item content.",
+ "properties": {
+ "color": {
+ "default": "default",
+ "description": "Color of the list item.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "rich_text": {
+ "description": "Array of rich text objects for the list item text.",
+ "items": {
+ "description": "Rich text object for creating text content in blocks.",
+ "properties": {
+ "annotations": {
+ "anyOf": [
+ {
+ "description": "Text styling annotations for rich text.",
+ "properties": {
+ "bold": {
+ "default": false,
+ "description": "Whether the text is bold.",
+ "title": "Bold",
+ "type": "boolean"
+ },
+ "code": {
+ "default": false,
+ "description": "Whether the text is formatted as inline code.",
+ "title": "Code",
+ "type": "boolean"
+ },
+ "color": {
+ "default": "default",
+ "description": "Color of the text or background.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "italic": {
+ "default": false,
+ "description": "Whether the text is italic.",
+ "title": "Italic",
+ "type": "boolean"
+ },
+ "strikethrough": {
+ "default": false,
+ "description": "Whether the text has strikethrough.",
+ "title": "Strikethrough",
+ "type": "boolean"
+ },
+ "underline": {
+ "default": false,
+ "description": "Whether the text is underlined.",
+ "title": "Underline",
+ "type": "boolean"
+ }
+ },
+ "title": "TextAnnotations",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional text styling annotations (bold, italic, etc.)."
+ },
+ "text": {
+ "description": "The text content object.",
+ "properties": {
+ "content": {
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
+ "examples": ["Hello, World!", "This is a paragraph of text."],
+ "maxLength": 2000,
+ "title": "Content",
+ "type": "string"
+ },
+ "link": {
+ "anyOf": [
+ {
+ "description": "Link object for hyperlinked text.",
+ "properties": {
+ "url": {
+ "description": "The URL the text links to.",
+ "examples": [
+ "https://www.notion.so",
+ "https://example.com"
+ ],
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url"],
+ "title": "TextLink",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional link for the text."
+ }
+ },
+ "required": ["content"],
+ "title": "TextContent",
+ "type": "object"
+ },
+ "type": {
+ "const": "text",
+ "default": "text",
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["text"],
+ "title": "RichTextInput",
+ "type": "object"
+ },
+ "minItems": 1,
+ "title": "Rich Text",
+ "type": "array"
+ }
+ },
+ "required": ["rich_text"],
+ "title": "ListItemInput",
+ "type": "object"
+ },
+ "object": {
+ "const": "block",
+ "default": "block",
+ "description": "Always 'block'.",
+ "title": "Object",
+ "type": "string"
+ },
+ "type": {
+ "const": "bulleted_list_item",
+ "default": "bulleted_list_item",
+ "description": "Block type.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["bulleted_list_item"],
+ "title": "BulletedListItemBlockInput",
+ "type": "object"
+ },
+ {
+ "description": "A numbered list item block object.",
+ "properties": {
+ "numbered_list_item": {
+ "description": "Numbered list item content.",
+ "properties": {
+ "color": {
+ "default": "default",
+ "description": "Color of the list item.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "rich_text": {
+ "description": "Array of rich text objects for the list item text.",
+ "items": {
+ "description": "Rich text object for creating text content in blocks.",
+ "properties": {
+ "annotations": {
+ "anyOf": [
+ {
+ "description": "Text styling annotations for rich text.",
+ "properties": {
+ "bold": {
+ "default": false,
+ "description": "Whether the text is bold.",
+ "title": "Bold",
+ "type": "boolean"
+ },
+ "code": {
+ "default": false,
+ "description": "Whether the text is formatted as inline code.",
+ "title": "Code",
+ "type": "boolean"
+ },
+ "color": {
+ "default": "default",
+ "description": "Color of the text or background.",
+ "enum": [
+ "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"
+ ],
+ "title": "BlockColor",
+ "type": "string"
+ },
+ "italic": {
+ "default": false,
+ "description": "Whether the text is italic.",
+ "title": "Italic",
+ "type": "boolean"
+ },
+ "strikethrough": {
+ "default": false,
+ "description": "Whether the text has strikethrough.",
+ "title": "Strikethrough",
+ "type": "boolean"
+ },
+ "underline": {
+ "default": false,
+ "description": "Whether the text is underlined.",
+ "title": "Underline",
+ "type": "boolean"
+ }
+ },
+ "title": "TextAnnotations",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional text styling annotations (bold, italic, etc.)."
+ },
+ "text": {
+ "description": "The text content object.",
+ "properties": {
+ "content": {
+ "description": "The actual text content. CRITICAL: Maximum 2000 characters per text object.",
+ "examples": ["Hello, World!", "This is a paragraph of text."],
+ "maxLength": 2000,
+ "title": "Content",
+ "type": "string"
+ },
+ "link": {
+ "anyOf": [
+ {
+ "description": "Link object for hyperlinked text.",
+ "properties": {
+ "url": {
+ "description": "The URL the text links to.",
+ "examples": [
+ "https://www.notion.so",
+ "https://example.com"
+ ],
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url"],
+ "title": "TextLink",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Optional link for the text."
+ }
+ },
+ "required": ["content"],
+ "title": "TextContent",
+ "type": "object"
+ },
+ "type": {
+ "const": "text",
+ "default": "text",
+ "description": "Type of rich text. Currently only 'text' is supported for input.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["text"],
+ "title": "RichTextInput",
+ "type": "object"
+ },
+ "minItems": 1,
+ "title": "Rich Text",
+ "type": "array"
+ }
+ },
+ "required": ["rich_text"],
+ "title": "ListItemInput",
+ "type": "object"
+ },
+ "object": {
+ "const": "block",
+ "default": "block",
+ "description": "Always 'block'.",
+ "title": "Object",
+ "type": "string"
+ },
+ "type": {
+ "const": "numbered_list_item",
+ "default": "numbered_list_item",
+ "description": "Block type.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["numbered_list_item"],
+ "title": "NumberedListItemBlockInput",
+ "type": "object"
+ }
+ ],
+ "properties": {}
+ },
+ "maxItems": 100,
+ "title": "Children",
+ "type": "array"
+ }
+ },
+ "required": ["block_id", "children"],
+ "title": "AppendTextBlocksRequest",
+ "type": "object"
+ },
+ "output_parameters": {
+ "properties": {
+ "data": {
+ "additionalProperties": false,
+ "description": "Data from the action execution",
+ "properties": {
+ "block": {
+ "additionalProperties": {
+ "type": "string"
+ },
+ "description": "Empty object corresponding to the type field.",
+ "title": "Block",
+ "type": "object"
+ },
+ "has_more": {
+ "description": "Whether there are more results available beyond this page.",
+ "title": "Has More",
+ "type": "boolean"
+ },
+ "next_cursor": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Cursor for pagination. Null if there are no more results.",
+ "title": "Next Cursor"
+ },
+ "object": {
+ "description": "Always 'list' for paginated responses.",
+ "title": "Object",
+ "type": "string"
+ },
+ "results": {
+ "description": "Array of newly created block objects that were appended as children.",
+ "items": {
+ "additionalProperties": true,
+ "description": "Notion block object returned in the results array.",
+ "properties": {
+ "archived": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether the block is archived.",
+ "title": "Archived"
+ },
+ "created_by": {
+ "anyOf": [
+ {
+ "description": "Partial user object representing a Notion user.",
+ "properties": {
+ "id": {
+ "description": "Unique identifier for the user (UUID format).",
+ "title": "Id",
+ "type": "string"
+ },
+ "object": {
+ "description": "Always 'user'.",
+ "title": "Object",
+ "type": "string"
+ }
+ },
+ "required": ["object", "id"],
+ "title": "PartialUser",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Partial user object representing the user who created the block.",
+ "title": "Created By"
+ },
+ "created_time": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "ISO 8601 timestamp of when the block was created.",
+ "title": "Created Time"
+ },
+ "has_children": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether the block has child blocks nested within it.",
+ "title": "Has Children"
+ },
+ "id": {
+ "description": "Unique identifier for the block (UUID v4 format).",
+ "title": "Id",
+ "type": "string"
+ },
+ "in_trash": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether the block is in the trash.",
+ "title": "In Trash"
+ },
+ "last_edited_by": {
+ "anyOf": [
+ {
+ "description": "Partial user object representing a Notion user.",
+ "properties": {
+ "id": {
+ "description": "Unique identifier for the user (UUID format).",
+ "title": "Id",
+ "type": "string"
+ },
+ "object": {
+ "description": "Always 'user'.",
+ "title": "Object",
+ "type": "string"
+ }
+ },
+ "required": ["object", "id"],
+ "title": "PartialUser",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Partial user object representing the user who last edited the block.",
+ "title": "Last Edited By"
+ },
+ "last_edited_time": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "ISO 8601 timestamp of when the block was last edited.",
+ "title": "Last Edited Time"
+ },
+ "object": {
+ "description": "Always 'block'.",
+ "title": "Object",
+ "type": "string"
+ },
+ "parent": {
+ "anyOf": [
+ {
+ "description": "Information about a block's parent.",
+ "properties": {
+ "block_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "UUID of the parent block (when type is 'block_id').",
+ "title": "Block Id"
+ },
+ "data_source_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "UUID of the parent data source (when type is 'data_source_id').",
+ "title": "Data Source Id"
+ },
+ "page_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "UUID of the parent page (when type is 'page_id').",
+ "title": "Page Id"
+ },
+ "type": {
+ "description": "Type of parent: 'page_id', 'block_id', or 'data_source_id'.",
+ "enum": ["page_id", "block_id", "data_source_id"],
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type"],
+ "title": "BlockParent",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Information about the block's parent.",
+ "title": "Parent"
+ },
+ "type": {
+ "description": "The type of block.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["object", "id", "type"],
+ "title": "Block",
+ "type": "object"
+ },
+ "title": "Results",
+ "type": "array"
+ },
+ "type": {
+ "description": "The type of items in the results array. Always 'block'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["object", "results", "has_more", "type", "block"],
+ "title": "Data",
+ "type": "object"
+ },
+ "error": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Error if any occurred during the execution of the action",
+ "title": "Error"
+ },
+ "successful": {
+ "description": "Whether or not the action execution was successful or not",
+ "title": "Successful",
+ "type": "boolean"
+ }
+ },
+ "required": ["data", "successful"],
+ "title": "AppendBlocksResponseWrapper",
+ "type": "object"
+ },
+ "scopes": [],
+ "tags": ["blocks", "text"],
+ "no_auth": false,
+ "status": "active",
+ "is_deprecated": false,
+ "deprecated": {
+ "displayName": "Append text blocks (paragraphs, headings, lists)",
+ "version": "20260113_00",
+ "available_versions": ["20260113_00"],
+ "is_deprecated": false,
+ "toolkit": {
+ "logo": "https://logos.composio.dev/api/notion"
+ }
+ }
+}
diff --git a/ts/packages/cli/test/__fixtures__/notion-archive-page.json b/ts/packages/cli/test/__fixtures__/notion-archive-page.json
new file mode 100644
index 000000000..166c2fbd8
--- /dev/null
+++ b/ts/packages/cli/test/__fixtures__/notion-archive-page.json
@@ -0,0 +1,540 @@
+{
+ "slug": "NOTION_ARCHIVE_NOTION_PAGE",
+ "name": "Archive Notion Page",
+ "description": "Archives (moves to trash) or unarchives (restores from trash) a specified Notion page.",
+ "available_versions": ["20260113_00"],
+ "version": "20260113_00",
+ "toolkit": {
+ "slug": "notion",
+ "name": "notion",
+ "logo": "https://logos.composio.dev/api/notion"
+ },
+ "input_parameters": {
+ "properties": {
+ "archive": {
+ "default": true,
+ "description": "Set to `true` to move the page to trash (archive), or `false` to restore it from trash (unarchive). Defaults to `true`.",
+ "title": "Archive",
+ "type": "boolean"
+ },
+ "page_id": {
+ "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.",
+ "examples": ["a1b2c3d4-e5f6-7890-1234-567890abcdef"],
+ "title": "Page Id",
+ "type": "string"
+ }
+ },
+ "required": ["page_id"],
+ "title": "ArchiveNotionPageRequest",
+ "type": "object"
+ },
+ "output_parameters": {
+ "properties": {
+ "data": {
+ "additionalProperties": false,
+ "description": "Data from the action execution",
+ "properties": {
+ "archived": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Indicates whether the page is archived. Set to true when the page is archived.",
+ "title": "Archived"
+ },
+ "cover": {
+ "anyOf": [
+ {
+ "properties": {
+ "external": {
+ "description": "External file configuration.",
+ "properties": {
+ "url": {
+ "description": "Publicly accessible HTTPS link to remote content.",
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url"],
+ "title": "ExternalFile",
+ "type": "object"
+ },
+ "type": {
+ "const": "external",
+ "description": "The constant string 'external'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "external"],
+ "title": "ExternalCover",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "file": {
+ "description": "Notion-hosted file configuration.",
+ "properties": {
+ "expiry_time": {
+ "description": "Timestamp in ISO 8601 format indicating when access expires.",
+ "title": "Expiry Time",
+ "type": "string"
+ },
+ "url": {
+ "description": "An authenticated HTTP GET URL to the file. The URL is valid for one hour.",
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url", "expiry_time"],
+ "title": "NotionHostedFile",
+ "type": "object"
+ },
+ "type": {
+ "const": "file",
+ "description": "The constant string 'file'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "file"],
+ "title": "FileCover",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Page cover image as a file object (external or Notion-hosted).",
+ "title": "Cover"
+ },
+ "created_by": {
+ "anyOf": [
+ {
+ "properties": {
+ "id": {
+ "description": "UUID string identifying the user uniquely.",
+ "title": "Id",
+ "type": "string"
+ },
+ "object": {
+ "const": "user",
+ "description": "Always \"user\".",
+ "title": "Object",
+ "type": "string"
+ }
+ },
+ "required": ["object", "id"],
+ "title": "UserPartial",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Partial user object representing the user who created the page.",
+ "title": "Created By"
+ },
+ "created_time": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Creation timestamp in ISO 8601 format.",
+ "title": "Created Time"
+ },
+ "icon": {
+ "anyOf": [
+ {
+ "properties": {
+ "emoji": {
+ "description": "The emoji character itself.",
+ "title": "Emoji",
+ "type": "string"
+ },
+ "type": {
+ "const": "emoji",
+ "description": "The constant string 'emoji'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "emoji"],
+ "title": "EmojiIcon",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "custom_emoji": {
+ "description": "Container object for custom emoji data.",
+ "properties": {
+ "id": {
+ "description": "Unique identifier for the custom emoji.",
+ "title": "Id",
+ "type": "string"
+ },
+ "name": {
+ "description": "Display name of the custom emoji.",
+ "title": "Name",
+ "type": "string"
+ },
+ "url": {
+ "description": "HTTPS URL pointing to the emoji image.",
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["id", "name", "url"],
+ "title": "CustomEmojiData",
+ "type": "object"
+ },
+ "type": {
+ "const": "custom_emoji",
+ "description": "The constant value 'custom_emoji'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "custom_emoji"],
+ "title": "CustomEmojiIcon",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "external": {
+ "description": "External file configuration.",
+ "properties": {
+ "url": {
+ "description": "Publicly accessible HTTPS link to remote content.",
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url"],
+ "title": "ExternalFile",
+ "type": "object"
+ },
+ "type": {
+ "const": "external",
+ "description": "The constant string 'external'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "external"],
+ "title": "ExternalIcon",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "file": {
+ "description": "Notion-hosted file configuration.",
+ "properties": {
+ "expiry_time": {
+ "description": "Timestamp in ISO 8601 format indicating when access expires.",
+ "title": "Expiry Time",
+ "type": "string"
+ },
+ "url": {
+ "description": "An authenticated HTTP GET URL to the file. The URL is valid for one hour.",
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url", "expiry_time"],
+ "title": "NotionHostedFile",
+ "type": "object"
+ },
+ "type": {
+ "const": "file",
+ "description": "The constant string 'file'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "file"],
+ "title": "FileIcon",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Page icon, which can be an emoji or file object (external or uploaded).",
+ "title": "Icon"
+ },
+ "id": {
+ "description": "Unique page identifier in UUIDv4 format.",
+ "title": "Id",
+ "type": "string"
+ },
+ "in_trash": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Indicates whether the page is in trash. Set to true when the page is archived.",
+ "title": "In Trash"
+ },
+ "last_edited_by": {
+ "anyOf": [
+ {
+ "properties": {
+ "id": {
+ "description": "UUID string identifying the user uniquely.",
+ "title": "Id",
+ "type": "string"
+ },
+ "object": {
+ "const": "user",
+ "description": "Always \"user\".",
+ "title": "Object",
+ "type": "string"
+ }
+ },
+ "required": ["object", "id"],
+ "title": "UserPartial",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Partial user object representing the user who last edited the page.",
+ "title": "Last Edited By"
+ },
+ "last_edited_time": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Most recent modification timestamp in ISO 8601 format.",
+ "title": "Last Edited Time"
+ },
+ "object": {
+ "const": "page",
+ "description": "Always the literal value 'page'.",
+ "title": "Object",
+ "type": "string"
+ },
+ "parent": {
+ "anyOf": [
+ {
+ "properties": {
+ "database_id": {
+ "description": "UUIDv4 string identifying the parent database.",
+ "title": "Database Id",
+ "type": "string"
+ },
+ "type": {
+ "const": "database_id",
+ "description": "The constant string 'database_id'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "database_id"],
+ "title": "DatabaseParent",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "data_source_id": {
+ "description": "UUIDv4 string identifying the parent data source.",
+ "title": "Data Source Id",
+ "type": "string"
+ },
+ "database_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "UUIDv4 string for the grandparent database (convenience field).",
+ "title": "Database Id"
+ },
+ "type": {
+ "const": "data_source_id",
+ "description": "The constant string 'data_source_id'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "data_source_id"],
+ "title": "DataSourceParent",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "page_id": {
+ "description": "UUIDv4 string identifying the parent page.",
+ "title": "Page Id",
+ "type": "string"
+ },
+ "type": {
+ "const": "page_id",
+ "description": "The constant string 'page_id'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "page_id"],
+ "title": "PageParent",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "type": {
+ "const": "workspace",
+ "description": "The constant string 'workspace'.",
+ "title": "Type",
+ "type": "string"
+ },
+ "workspace": {
+ "const": true,
+ "description": "Always true, indicating the page is at workspace level.",
+ "title": "Workspace",
+ "type": "boolean"
+ }
+ },
+ "required": ["type", "workspace"],
+ "title": "WorkspaceParent",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "block_id": {
+ "description": "UUIDv4 string identifying the parent block.",
+ "title": "Block Id",
+ "type": "string"
+ },
+ "type": {
+ "const": "block_id",
+ "description": "The constant string 'block_id'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "block_id"],
+ "title": "BlockParent",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Parent container information specifying where the page is located.",
+ "title": "Parent"
+ },
+ "properties": {
+ "anyOf": [
+ {
+ "additionalProperties": true,
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Key-value pairs of page property data. The structure depends on the parent type and specific properties defined for the page.",
+ "title": "Properties"
+ },
+ "public_url": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Public web URL if the page is published; otherwise null.",
+ "title": "Public Url"
+ },
+ "url": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Standard Notion page URL.",
+ "title": "Url"
+ }
+ },
+ "required": ["object", "id"],
+ "title": "Data",
+ "type": "object"
+ },
+ "error": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Error if any occurred during the execution of the action",
+ "title": "Error"
+ },
+ "successful": {
+ "description": "Whether or not the action execution was successful or not",
+ "title": "Successful",
+ "type": "boolean"
+ }
+ },
+ "required": ["data", "successful"],
+ "title": "ArchiveNotionPageResponseWrapper",
+ "type": "object"
+ },
+ "scopes": ["Read content"],
+ "tags": ["destructiveHint", "openWorldHint"],
+ "no_auth": false,
+ "status": "active",
+ "is_deprecated": false,
+ "deprecated": {
+ "displayName": "Archive Notion Page",
+ "version": "20260113_00",
+ "available_versions": ["20260113_00"],
+ "is_deprecated": false,
+ "toolkit": {
+ "logo": "https://logos.composio.dev/api/notion"
+ }
+ }
+}
diff --git a/ts/packages/cli/test/__fixtures__/notion-create-comment.json b/ts/packages/cli/test/__fixtures__/notion-create-comment.json
new file mode 100644
index 000000000..3beb1d703
--- /dev/null
+++ b/ts/packages/cli/test/__fixtures__/notion-create-comment.json
@@ -0,0 +1,676 @@
+{
+ "slug": "NOTION_CREATE_COMMENT",
+ "name": "Create comment",
+ "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).",
+ "available_versions": ["20260113_00"],
+ "version": "20260113_00",
+ "toolkit": {
+ "slug": "notion",
+ "name": "notion",
+ "logo": "https://logos.composio.dev/api/notion"
+ },
+ "input_parameters": {
+ "properties": {
+ "comment": {
+ "additionalProperties": false,
+ "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.",
+ "examples": [
+ {
+ "content": "Looks good to me!"
+ },
+ {
+ "text": "Great work!"
+ },
+ {
+ "bold": true,
+ "content": "Fix typo"
+ }
+ ],
+ "properties": {
+ "block_property": {
+ "default": "paragraph",
+ "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).",
+ "enum": [
+ "paragraph",
+ "heading_1",
+ "heading_2",
+ "heading_3",
+ "callout",
+ "to_do",
+ "toggle",
+ "quote",
+ "bulleted_list_item",
+ "numbered_list_item",
+ "file",
+ "image",
+ "video",
+ "divider"
+ ],
+ "examples": [
+ "paragraph",
+ "heading_1",
+ "heading_2",
+ "heading_3",
+ "bulleted_list_item",
+ "numbered_list_item",
+ "to_do",
+ "callout",
+ "toggle",
+ "quote",
+ "divider"
+ ],
+ "title": "Block Property",
+ "type": "string"
+ },
+ "bold": {
+ "default": false,
+ "description": "Indicates if the text is bold.",
+ "examples": [true, false],
+ "title": "Bold",
+ "type": "boolean"
+ },
+ "code": {
+ "default": false,
+ "description": "Indicates if the text is formatted as code.",
+ "examples": [true, false],
+ "title": "Code",
+ "type": "boolean"
+ },
+ "color": {
+ "default": "default",
+ "description": "The color of the text background or text itself.",
+ "examples": ["blue_background", "yellow_background", "gray", "purple"],
+ "title": "Color",
+ "type": "string"
+ },
+ "content": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "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.",
+ "examples": [
+ "Hello World",
+ "This is **bold** and *italic* text",
+ "Visit [our site](https://example.com)",
+ "Use `code` snippets",
+ "~~Strikethrough~~ text"
+ ],
+ "title": "Content"
+ },
+ "italic": {
+ "default": false,
+ "description": "Indicates if the text is italic.",
+ "examples": [true, false],
+ "title": "Italic",
+ "type": "boolean"
+ },
+ "link": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "The URL of the rich text object or the file to be uploaded or image/video link",
+ "examples": ["https://www.google.com"],
+ "title": "Link"
+ },
+ "strikethrough": {
+ "default": false,
+ "description": "Indicates if the text has strikethrough.",
+ "examples": [true, false],
+ "title": "Strikethrough",
+ "type": "boolean"
+ },
+ "underline": {
+ "default": false,
+ "description": "Indicates if the text is underlined.",
+ "examples": [true, false],
+ "title": "Underline",
+ "type": "boolean"
+ }
+ },
+ "title": "Comment",
+ "type": "object"
+ },
+ "discussion_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "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.",
+ "examples": ["yyyyyyyy-yyyy-yyyy-yyyy-yyyyyyyyyyyy"],
+ "title": "Discussion Id"
+ },
+ "parent_page_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "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.",
+ "examples": ["xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"],
+ "title": "Parent Page Id"
+ }
+ },
+ "required": ["comment"],
+ "title": "CreateCommentRequest",
+ "type": "object"
+ },
+ "output_parameters": {
+ "properties": {
+ "data": {
+ "additionalProperties": false,
+ "description": "Data from the action execution",
+ "properties": {
+ "attachments": {
+ "anyOf": [
+ {
+ "items": {
+ "description": "File attachment on a comment.",
+ "properties": {
+ "category": {
+ "description": "The category of this attachment. Possible values are: 'audio', 'image', 'pdf', 'productivity', and 'video'.",
+ "title": "Category",
+ "type": "string"
+ },
+ "file": {
+ "description": "File object containing temporary download information.",
+ "properties": {
+ "expiry_time": {
+ "description": "ISO 8601 timestamp indicating when the temporary download URL expires.",
+ "title": "Expiry Time",
+ "type": "string"
+ },
+ "url": {
+ "description": "A temporary download link generated at the time of retrieving the comment.",
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url", "expiry_time"],
+ "title": "NotionCommentAttachmentFile",
+ "type": "object"
+ }
+ },
+ "required": ["category", "file"],
+ "title": "NotionCommentAttachment",
+ "type": "object"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Array of file attachments on the comment (maximum 3 attachments).",
+ "title": "Attachments"
+ },
+ "created_by": {
+ "anyOf": [
+ {
+ "description": "Partial user object containing information about the comment author.",
+ "properties": {
+ "id": {
+ "description": "Unique identifier for the user in UUID format.",
+ "title": "Id",
+ "type": "string"
+ },
+ "object": {
+ "const": "user",
+ "default": "user",
+ "description": "Always 'user'.",
+ "title": "Object",
+ "type": "string"
+ }
+ },
+ "required": ["id"],
+ "title": "NotionPartialUser",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Partial user object containing information about the comment author.",
+ "title": "Created By"
+ },
+ "created_time": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "ISO 8601 timestamp marking when the comment was created.",
+ "title": "Created Time"
+ },
+ "discussion_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Thread identifier associating the comment with a discussion in UUIDv4 format.",
+ "title": "Discussion Id"
+ },
+ "display_name": {
+ "anyOf": [
+ {
+ "description": "Custom display name configuration for the comment author.",
+ "properties": {
+ "resolved_name": {
+ "description": "The finalized display name that is rendered in the comment.",
+ "title": "Resolved Name",
+ "type": "string"
+ },
+ "type": {
+ "description": "Type of display name. One of: 'integration', 'user', or 'custom'.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "resolved_name"],
+ "title": "NotionDisplayName",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Custom display name configuration for the comment author, overriding the default author name.",
+ "title": "Display Name"
+ },
+ "id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Unique identifier for the comment in UUIDv4 format.",
+ "title": "Id"
+ },
+ "last_edited_time": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "ISO 8601 timestamp of the most recent modification to the comment.",
+ "title": "Last Edited Time"
+ },
+ "object": {
+ "anyOf": [
+ {
+ "const": "comment",
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Always 'comment'.",
+ "title": "Object"
+ },
+ "parent": {
+ "anyOf": [
+ {
+ "description": "Parent reference when the comment is on a page.",
+ "properties": {
+ "page_id": {
+ "description": "Page identifier in UUIDv4 format.",
+ "title": "Page Id",
+ "type": "string"
+ },
+ "type": {
+ "const": "page_id",
+ "default": "page_id",
+ "description": "Type identifier for page parent.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["page_id"],
+ "title": "NotionCommentParentPage",
+ "type": "object"
+ },
+ {
+ "description": "Parent reference when the comment is on a block.",
+ "properties": {
+ "block_id": {
+ "description": "Block identifier in UUIDv4 format.",
+ "title": "Block Id",
+ "type": "string"
+ },
+ "type": {
+ "const": "block_id",
+ "default": "block_id",
+ "description": "Type identifier for block parent.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["block_id"],
+ "title": "NotionCommentParentBlock",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "References the comment's parent (page or block).",
+ "title": "Parent"
+ },
+ "rich_text": {
+ "anyOf": [
+ {
+ "items": {
+ "description": "Rich text element supporting text, mention, and equation types.",
+ "properties": {
+ "annotations": {
+ "anyOf": [
+ {
+ "description": "Styling configuration for rich text.",
+ "properties": {
+ "bold": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether the text is bold.",
+ "title": "Bold"
+ },
+ "code": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether the text is formatted as code.",
+ "title": "Code"
+ },
+ "color": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Text color. One of: 'default', 'gray', 'brown', 'orange', 'yellow', 'green', 'blue', 'purple', 'pink', 'red', or any of these with '_background' suffix.",
+ "title": "Color"
+ },
+ "italic": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether the text is italic.",
+ "title": "Italic"
+ },
+ "strikethrough": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether the text has strikethrough.",
+ "title": "Strikethrough"
+ },
+ "underline": {
+ "anyOf": [
+ {
+ "type": "boolean"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Whether the text is underlined.",
+ "title": "Underline"
+ }
+ },
+ "title": "RichTextAnnotations",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Styling configuration for the rich text."
+ },
+ "equation": {
+ "anyOf": [
+ {
+ "description": "Equation content for an equation-type rich text element.",
+ "properties": {
+ "expression": {
+ "description": "LaTeX formula expression.",
+ "title": "Expression",
+ "type": "string"
+ }
+ },
+ "required": ["expression"],
+ "title": "RichTextEquation",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Present when type is 'equation'. Contains the LaTeX expression."
+ },
+ "href": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "URL if the text is a link, otherwise null.",
+ "title": "Href"
+ },
+ "mention": {
+ "anyOf": [
+ {
+ "additionalProperties": true,
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Present when type is 'mention'. Contains mention-specific properties for database, date, link_preview, page, user, or template_mention types.",
+ "title": "Mention"
+ },
+ "plain_text": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Unformatted text content, providing a convenient way to access text without styling.",
+ "title": "Plain Text"
+ },
+ "text": {
+ "anyOf": [
+ {
+ "description": "Text content for a text-type rich text element.",
+ "properties": {
+ "content": {
+ "description": "The actual text content.",
+ "title": "Content",
+ "type": "string"
+ },
+ "link": {
+ "anyOf": [
+ {
+ "description": "Link object within text content.",
+ "properties": {
+ "url": {
+ "description": "The URL of the link.",
+ "title": "Url",
+ "type": "string"
+ }
+ },
+ "required": ["url"],
+ "title": "RichTextLink",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Link object containing URL, or null if no link."
+ }
+ },
+ "required": ["content"],
+ "title": "RichTextTextContent",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Present when type is 'text'. Contains the text content and optional link."
+ },
+ "type": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Type of rich text element. One of: 'text', 'mention', 'equation'.",
+ "title": "Type"
+ }
+ },
+ "title": "RichTextElement",
+ "type": "object"
+ },
+ "type": "array"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Array of rich text objects representing the content of the comment, which supports rich text formatting and links.",
+ "title": "Rich Text"
+ }
+ },
+ "title": "Data",
+ "type": "object"
+ },
+ "error": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Error if any occurred during the execution of the action",
+ "title": "Error"
+ },
+ "successful": {
+ "description": "Whether or not the action execution was successful or not",
+ "title": "Successful",
+ "type": "boolean"
+ }
+ },
+ "required": ["data", "successful"],
+ "title": "CreateCommentResponseWrapper",
+ "type": "object"
+ },
+ "scopes": ["comment:write"],
+ "tags": ["important", "openWorldHint"],
+ "no_auth": false,
+ "status": "active",
+ "is_deprecated": false,
+ "deprecated": {
+ "displayName": "Create comment",
+ "version": "20260113_00",
+ "available_versions": ["20260113_00"],
+ "is_deprecated": false,
+ "toolkit": {
+ "logo": "https://logos.composio.dev/api/notion"
+ }
+ }
+}
diff --git a/ts/packages/cli/test/__fixtures__/notion-delete-block.json b/ts/packages/cli/test/__fixtures__/notion-delete-block.json
new file mode 100644
index 000000000..d47c84d60
--- /dev/null
+++ b/ts/packages/cli/test/__fixtures__/notion-delete-block.json
@@ -0,0 +1,592 @@
+{
+ "slug": "NOTION_DELETE_BLOCK",
+ "name": "Delete a block",
+ "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.",
+ "available_versions": ["20260113_00"],
+ "version": "20260113_00",
+ "toolkit": {
+ "slug": "notion",
+ "name": "notion",
+ "logo": "https://logos.composio.dev/api/notion"
+ },
+ "input_parameters": {
+ "description": "Request model for deleting (archiving) a Notion block.",
+ "properties": {
+ "block_id": {
+ "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`.",
+ "examples": ["59833787-2cf9-4fdf-8782-e53db20768a5"],
+ "title": "Block Id",
+ "type": "string"
+ }
+ },
+ "required": ["block_id"],
+ "title": "DeleteBlockRequest",
+ "type": "object"
+ },
+ "output_parameters": {
+ "properties": {
+ "data": {
+ "additionalProperties": true,
+ "description": "Data from the action execution",
+ "properties": {
+ "archived": {
+ "description": "Whether the block is archived (deleted). Set to true after deletion, which moves the block to Trash in the Notion UI.",
+ "title": "Archived",
+ "type": "boolean"
+ },
+ "created_by": {
+ "additionalProperties": false,
+ "description": "User object representing who created the block.",
+ "properties": {
+ "avatar_url": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "URL of the user's chosen avatar image.",
+ "title": "Avatar Url"
+ },
+ "bot": {
+ "anyOf": [
+ {
+ "properties": {
+ "owner": {
+ "anyOf": [
+ {
+ "properties": {
+ "type": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Either 'workspace' or 'user'.",
+ "title": "Type"
+ }
+ },
+ "title": "BotOwner",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Owner information for the bot."
+ },
+ "workspace_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "ID of the bot's workspace.",
+ "title": "Workspace Id"
+ },
+ "workspace_limits": {
+ "anyOf": [
+ {
+ "properties": {
+ "max_file_upload_size_in_bytes": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Maximum file upload size in bytes.",
+ "title": "Max File Upload Size In Bytes"
+ }
+ },
+ "title": "WorkspaceLimits",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Workspace restrictions for the bot."
+ },
+ "workspace_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Name of the bot's workspace. Null if owner type is 'user'.",
+ "title": "Workspace Name"
+ }
+ },
+ "title": "BotDetails",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Present when type is 'bot'.",
+ "title": "Bot"
+ },
+ "id": {
+ "description": "Unique identifier for the user in UUID format.",
+ "title": "Id",
+ "type": "string"
+ },
+ "name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "User's name as displayed in Notion.",
+ "title": "Name"
+ },
+ "object": {
+ "description": "Always 'user'.",
+ "title": "Object",
+ "type": "string"
+ },
+ "person": {
+ "anyOf": [
+ {
+ "properties": {
+ "email": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Email address. Present only if integration has user capability access.",
+ "title": "Email"
+ }
+ },
+ "title": "PersonDetails",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Present when type is 'person'.",
+ "title": "Person"
+ },
+ "type": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Type of user. Either 'person' or 'bot'.",
+ "title": "Type"
+ }
+ },
+ "required": ["object", "id"],
+ "title": "Created By",
+ "type": "object"
+ },
+ "created_time": {
+ "description": "ISO 8601 timestamp of when the block was created.",
+ "title": "Created Time",
+ "type": "string"
+ },
+ "has_children": {
+ "description": "Whether the block has child blocks.",
+ "title": "Has Children",
+ "type": "boolean"
+ },
+ "id": {
+ "description": "Unique identifier for the block in UUIDv4 format.",
+ "title": "Id",
+ "type": "string"
+ },
+ "in_trash": {
+ "description": "Whether the block is in trash (deleted).",
+ "title": "In Trash",
+ "type": "boolean"
+ },
+ "last_edited_by": {
+ "additionalProperties": false,
+ "description": "User object representing who last edited the block.",
+ "properties": {
+ "avatar_url": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "URL of the user's chosen avatar image.",
+ "title": "Avatar Url"
+ },
+ "bot": {
+ "anyOf": [
+ {
+ "properties": {
+ "owner": {
+ "anyOf": [
+ {
+ "properties": {
+ "type": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Either 'workspace' or 'user'.",
+ "title": "Type"
+ }
+ },
+ "title": "BotOwner",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Owner information for the bot."
+ },
+ "workspace_id": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "ID of the bot's workspace.",
+ "title": "Workspace Id"
+ },
+ "workspace_limits": {
+ "anyOf": [
+ {
+ "properties": {
+ "max_file_upload_size_in_bytes": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Maximum file upload size in bytes.",
+ "title": "Max File Upload Size In Bytes"
+ }
+ },
+ "title": "WorkspaceLimits",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Workspace restrictions for the bot."
+ },
+ "workspace_name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Name of the bot's workspace. Null if owner type is 'user'.",
+ "title": "Workspace Name"
+ }
+ },
+ "title": "BotDetails",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Present when type is 'bot'.",
+ "title": "Bot"
+ },
+ "id": {
+ "description": "Unique identifier for the user in UUID format.",
+ "title": "Id",
+ "type": "string"
+ },
+ "name": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "User's name as displayed in Notion.",
+ "title": "Name"
+ },
+ "object": {
+ "description": "Always 'user'.",
+ "title": "Object",
+ "type": "string"
+ },
+ "person": {
+ "anyOf": [
+ {
+ "properties": {
+ "email": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Email address. Present only if integration has user capability access.",
+ "title": "Email"
+ }
+ },
+ "title": "PersonDetails",
+ "type": "object"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Present when type is 'person'.",
+ "title": "Person"
+ },
+ "type": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Type of user. Either 'person' or 'bot'.",
+ "title": "Type"
+ }
+ },
+ "required": ["object", "id"],
+ "title": "Last Edited By",
+ "type": "object"
+ },
+ "last_edited_time": {
+ "description": "ISO 8601 timestamp of when the block was last edited.",
+ "title": "Last Edited Time",
+ "type": "string"
+ },
+ "object": {
+ "description": "Always \"block\".",
+ "title": "Object",
+ "type": "string"
+ },
+ "parent": {
+ "anyOf": [
+ {
+ "properties": {
+ "database_id": {
+ "description": "ID of parent database in UUIDv4 format.",
+ "title": "Database Id",
+ "type": "string"
+ },
+ "type": {
+ "const": "database_id",
+ "description": "Type of parent.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "database_id"],
+ "title": "DatabaseIdParent",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "page_id": {
+ "description": "ID of parent page in UUIDv4 format.",
+ "title": "Page Id",
+ "type": "string"
+ },
+ "type": {
+ "const": "page_id",
+ "description": "Type of parent.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "page_id"],
+ "title": "PageIdParent",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "block_id": {
+ "description": "ID of parent block in UUIDv4 format.",
+ "title": "Block Id",
+ "type": "string"
+ },
+ "type": {
+ "const": "block_id",
+ "description": "Type of parent.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "block_id"],
+ "title": "BlockIdParent",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "type": {
+ "const": "workspace",
+ "description": "Type of parent.",
+ "title": "Type",
+ "type": "string"
+ },
+ "workspace": {
+ "description": "Always true when type is 'workspace'.",
+ "title": "Workspace",
+ "type": "boolean"
+ }
+ },
+ "required": ["type", "workspace"],
+ "title": "WorkspaceParent",
+ "type": "object"
+ },
+ {
+ "properties": {
+ "data_source_id": {
+ "description": "ID of parent data source in UUIDv4 format.",
+ "title": "Data Source Id",
+ "type": "string"
+ },
+ "type": {
+ "const": "data_source_id",
+ "description": "Type of parent.",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": ["type", "data_source_id"],
+ "title": "DataSourceIdParent",
+ "type": "object"
+ }
+ ],
+ "description": "Information about the block's parent container.",
+ "title": "Parent"
+ },
+ "type": {
+ "description": "Type of block (e.g., 'paragraph', 'heading_1', 'heading_2', 'heading_3', 'bulleted_list_item', 'numbered_list_item', 'to_do', etc.).",
+ "title": "Type",
+ "type": "string"
+ }
+ },
+ "required": [
+ "object",
+ "id",
+ "parent",
+ "type",
+ "created_time",
+ "created_by",
+ "last_edited_time",
+ "last_edited_by",
+ "archived",
+ "in_trash",
+ "has_children"
+ ],
+ "title": "Data",
+ "type": "object"
+ },
+ "error": {
+ "anyOf": [
+ {
+ "type": "string"
+ },
+ {
+ "type": "null"
+ }
+ ],
+ "default": null,
+ "description": "Error if any occurred during the execution of the action",
+ "title": "Error"
+ },
+ "successful": {
+ "description": "Whether or not the action execution was successful or not",
+ "title": "Successful",
+ "type": "boolean"
+ }
+ },
+ "required": ["data", "successful"],
+ "title": "DeleteBlockResponseWrapper",
+ "type": "object"
+ },
+ "scopes": ["Read content", "Update content", "Insert content"],
+ "tags": ["destructiveHint", "important", "openWorldHint"],
+ "no_auth": false,
+ "status": "active",
+ "is_deprecated": false,
+ "deprecated": {
+ "displayName": "Delete a block",
+ "version": "20260113_00",
+ "available_versions": ["20260113_00"],
+ "is_deprecated": false,
+ "toolkit": {
+ "logo": "https://logos.composio.dev/api/notion"
+ }
+ }
+}
diff --git a/ts/packages/cli/test/src/generation/typescript/__snapshots__/generate-type-from-json-schema.test.ts.snap b/ts/packages/cli/test/src/generation/typescript/__snapshots__/generate-type-from-json-schema.test.ts.snap
new file mode 100644
index 000000000..7ad43050d
--- /dev/null
+++ b/ts/packages/cli/test/src/generation/typescript/__snapshots__/generate-type-from-json-schema.test.ts.snap
@@ -0,0 +1,787 @@
+// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
+
+exports[`generateTypeFromJsonSchema > control group - simple schemas without discriminator > should generate type for NOTION_ARCHIVE_NOTION_PAGE (two properties) 1`] = `
+"type NOTION_ARCHIVE_NOTION_PAGE_INPUT = {
+ /**
+ * Archive
+ * @description Set to \`true\` to move the page to trash (archive), or \`false\` to restore it from trash (unarchive). Defaults to \`true\`.
+ * @default true
+ */
+ archive: boolean;
+ /**
+ * Page Id
+ * @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.
+ */
+ page_id?: string;
+};"
+`;
+
+exports[`generateTypeFromJsonSchema > control group - simple schemas without discriminator > should generate type for NOTION_CREATE_COMMENT (moderate complexity with nested objects) 1`] = `
+"type NOTION_CREATE_COMMENT_INPUT = {
+ /**
+ * Comment
+ * @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.
+ */
+ comment?: {
+ /**
+ * Block Property
+ * @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).
+ * @default paragraph
+ * @enum {string}
+ */
+ block_property: "paragraph" | "heading_1" | "heading_2" | "heading_3" | "callout" | "to_do" | "toggle" | "quote" | "bulleted_list_item" | "numbered_list_item" | "file" | "image" | "video" | "divider";
+ /**
+ * Bold
+ * @description Indicates if the text is bold.
+ * @default false
+ */
+ bold: boolean;
+ /**
+ * Code
+ * @description Indicates if the text is formatted as code.
+ * @default false
+ */
+ code: boolean;
+ /**
+ * Color
+ * @description The color of the text background or text itself.
+ * @default default
+ */
+ color: string;
+ /**
+ * Content
+ * @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.
+ * @default null
+ */
+ content: string | null;
+ /**
+ * Italic
+ * @description Indicates if the text is italic.
+ * @default false
+ */
+ italic: boolean;
+ /**
+ * Link
+ * @description The URL of the rich text object or the file to be uploaded or image/video link
+ * @default null
+ */
+ link: string | null;
+ /**
+ * Strikethrough
+ * @description Indicates if the text has strikethrough.
+ * @default false
+ */
+ strikethrough: boolean;
+ /**
+ * Underline
+ * @description Indicates if the text is underlined.
+ * @default false
+ */
+ underline: boolean;
+ };
+ /**
+ * Discussion Id
+ * @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.
+ * @default null
+ */
+ discussion_id: string | null;
+ /**
+ * Parent Page Id
+ * @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.
+ * @default null
+ */
+ parent_page_id: string | null;
+};"
+`;
+
+exports[`generateTypeFromJsonSchema > control group - simple schemas without discriminator > should generate type for NOTION_DELETE_BLOCK (simple single property) 1`] = `
+"type NOTION_DELETE_BLOCK_INPUT = {
+ /**
+ * Block Id
+ * @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\`.
+ */
+ block_id?: string;
+};"
+`;
+
+exports[`generateTypeFromJsonSchema > problematic schema - discriminator with $defs references > should generate type for NOTION_APPEND_TEXT_BLOCKS (discriminator with oneOf) 1`] = `
+"type NOTION_APPEND_TEXT_BLOCKS_INPUT = {
+ /**
+ * After
+ * @description Optional UUID of an existing child block. New blocks will be inserted after this block.
+ * @default null
+ */
+ after: string | null;
+ /**
+ * Block Id
+ * @description The UUID of the parent block or page to append children to.
+ */
+ block_id?: string;
+ /**
+ * Children
+ * @description Array of text block objects to append (also accepts 'blocks' as parameter name). Supported types:
+ * - paragraph: Regular text paragraph
+ * - heading_1, heading_2, heading_3: Section headings
+ * - bulleted_list_item: Bullet point
+ * - numbered_list_item: Numbered list item
+ *
+ * ⚠️ Text content limited to 2000 characters per rich_text text.content field.
+ * Max 100 blocks per request.
+ */
+ children?: ({
+ /**
+ * Object
+ * @description Always 'block'.
+ * @default block
+ * @constant
+ */
+ object: "block";
+ /**
+ * ParagraphInput
+ * @description Paragraph content.
+ */
+ paragraph: {
+ /**
+ * BlockColor
+ * @description Color of the paragraph text or background.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Rich Text
+ * @description Array of rich text objects. Each text.content is limited to 2000 chars.
+ */
+ rich_text: {
+ /**
+ * @description Optional text styling annotations (bold, italic, etc.).
+ * @default null
+ */
+ annotations: {
+ /**
+ * Bold
+ * @description Whether the text is bold.
+ * @default false
+ */
+ bold: boolean;
+ /**
+ * Code
+ * @description Whether the text is formatted as inline code.
+ * @default false
+ */
+ code: boolean;
+ /**
+ * BlockColor
+ * @description Color of the text or background.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Italic
+ * @description Whether the text is italic.
+ * @default false
+ */
+ italic: boolean;
+ /**
+ * Strikethrough
+ * @description Whether the text has strikethrough.
+ * @default false
+ */
+ strikethrough: boolean;
+ /**
+ * Underline
+ * @description Whether the text is underlined.
+ * @default false
+ */
+ underline: boolean;
+ } | null;
+ /**
+ * TextContent
+ * @description The text content object.
+ */
+ text: {
+ /**
+ * Content
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
+ */
+ content: string;
+ /**
+ * @description Optional link for the text.
+ * @default null
+ */
+ link: {
+ /**
+ * Url
+ * @description The URL the text links to.
+ */
+ url: string;
+ } | null;
+ };
+ /**
+ * Type
+ * @description Type of rich text. Currently only 'text' is supported for input.
+ * @default text
+ * @constant
+ */
+ type: "text";
+ }[];
+ };
+ /**
+ * Type
+ * @description Block type.
+ * @default paragraph
+ * @constant
+ */
+ type: "paragraph";
+ } | {
+ /**
+ * HeadingInput
+ * @description Heading 1 content.
+ */
+ heading_1: {
+ /**
+ * BlockColor
+ * @description Color of the heading.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Is Toggleable
+ * @description Whether the heading can be toggled to show/hide content.
+ * @default false
+ */
+ is_toggleable: boolean;
+ /**
+ * Rich Text
+ * @description Array of rich text objects for the heading text.
+ */
+ rich_text: {
+ /**
+ * @description Optional text styling annotations (bold, italic, etc.).
+ * @default null
+ */
+ annotations: {
+ /**
+ * Bold
+ * @description Whether the text is bold.
+ * @default false
+ */
+ bold: boolean;
+ /**
+ * Code
+ * @description Whether the text is formatted as inline code.
+ * @default false
+ */
+ code: boolean;
+ /**
+ * BlockColor
+ * @description Color of the text or background.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Italic
+ * @description Whether the text is italic.
+ * @default false
+ */
+ italic: boolean;
+ /**
+ * Strikethrough
+ * @description Whether the text has strikethrough.
+ * @default false
+ */
+ strikethrough: boolean;
+ /**
+ * Underline
+ * @description Whether the text is underlined.
+ * @default false
+ */
+ underline: boolean;
+ } | null;
+ /**
+ * TextContent
+ * @description The text content object.
+ */
+ text: {
+ /**
+ * Content
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
+ */
+ content: string;
+ /**
+ * @description Optional link for the text.
+ * @default null
+ */
+ link: {
+ /**
+ * Url
+ * @description The URL the text links to.
+ */
+ url: string;
+ } | null;
+ };
+ /**
+ * Type
+ * @description Type of rich text. Currently only 'text' is supported for input.
+ * @default text
+ * @constant
+ */
+ type: "text";
+ }[];
+ };
+ /**
+ * Object
+ * @description Always 'block'.
+ * @default block
+ * @constant
+ */
+ object: "block";
+ /**
+ * Type
+ * @description Block type.
+ * @default heading_1
+ * @constant
+ */
+ type: "heading_1";
+ } | {
+ /**
+ * HeadingInput
+ * @description Heading 2 content.
+ */
+ heading_2: {
+ /**
+ * BlockColor
+ * @description Color of the heading.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Is Toggleable
+ * @description Whether the heading can be toggled to show/hide content.
+ * @default false
+ */
+ is_toggleable: boolean;
+ /**
+ * Rich Text
+ * @description Array of rich text objects for the heading text.
+ */
+ rich_text: {
+ /**
+ * @description Optional text styling annotations (bold, italic, etc.).
+ * @default null
+ */
+ annotations: {
+ /**
+ * Bold
+ * @description Whether the text is bold.
+ * @default false
+ */
+ bold: boolean;
+ /**
+ * Code
+ * @description Whether the text is formatted as inline code.
+ * @default false
+ */
+ code: boolean;
+ /**
+ * BlockColor
+ * @description Color of the text or background.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Italic
+ * @description Whether the text is italic.
+ * @default false
+ */
+ italic: boolean;
+ /**
+ * Strikethrough
+ * @description Whether the text has strikethrough.
+ * @default false
+ */
+ strikethrough: boolean;
+ /**
+ * Underline
+ * @description Whether the text is underlined.
+ * @default false
+ */
+ underline: boolean;
+ } | null;
+ /**
+ * TextContent
+ * @description The text content object.
+ */
+ text: {
+ /**
+ * Content
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
+ */
+ content: string;
+ /**
+ * @description Optional link for the text.
+ * @default null
+ */
+ link: {
+ /**
+ * Url
+ * @description The URL the text links to.
+ */
+ url: string;
+ } | null;
+ };
+ /**
+ * Type
+ * @description Type of rich text. Currently only 'text' is supported for input.
+ * @default text
+ * @constant
+ */
+ type: "text";
+ }[];
+ };
+ /**
+ * Object
+ * @description Always 'block'.
+ * @default block
+ * @constant
+ */
+ object: "block";
+ /**
+ * Type
+ * @description Block type.
+ * @default heading_2
+ * @constant
+ */
+ type: "heading_2";
+ } | {
+ /**
+ * HeadingInput
+ * @description Heading 3 content.
+ */
+ heading_3: {
+ /**
+ * BlockColor
+ * @description Color of the heading.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Is Toggleable
+ * @description Whether the heading can be toggled to show/hide content.
+ * @default false
+ */
+ is_toggleable: boolean;
+ /**
+ * Rich Text
+ * @description Array of rich text objects for the heading text.
+ */
+ rich_text: {
+ /**
+ * @description Optional text styling annotations (bold, italic, etc.).
+ * @default null
+ */
+ annotations: {
+ /**
+ * Bold
+ * @description Whether the text is bold.
+ * @default false
+ */
+ bold: boolean;
+ /**
+ * Code
+ * @description Whether the text is formatted as inline code.
+ * @default false
+ */
+ code: boolean;
+ /**
+ * BlockColor
+ * @description Color of the text or background.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Italic
+ * @description Whether the text is italic.
+ * @default false
+ */
+ italic: boolean;
+ /**
+ * Strikethrough
+ * @description Whether the text has strikethrough.
+ * @default false
+ */
+ strikethrough: boolean;
+ /**
+ * Underline
+ * @description Whether the text is underlined.
+ * @default false
+ */
+ underline: boolean;
+ } | null;
+ /**
+ * TextContent
+ * @description The text content object.
+ */
+ text: {
+ /**
+ * Content
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
+ */
+ content: string;
+ /**
+ * @description Optional link for the text.
+ * @default null
+ */
+ link: {
+ /**
+ * Url
+ * @description The URL the text links to.
+ */
+ url: string;
+ } | null;
+ };
+ /**
+ * Type
+ * @description Type of rich text. Currently only 'text' is supported for input.
+ * @default text
+ * @constant
+ */
+ type: "text";
+ }[];
+ };
+ /**
+ * Object
+ * @description Always 'block'.
+ * @default block
+ * @constant
+ */
+ object: "block";
+ /**
+ * Type
+ * @description Block type.
+ * @default heading_3
+ * @constant
+ */
+ type: "heading_3";
+ } | {
+ /**
+ * ListItemInput
+ * @description Bulleted list item content.
+ */
+ bulleted_list_item: {
+ /**
+ * BlockColor
+ * @description Color of the list item.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Rich Text
+ * @description Array of rich text objects for the list item text.
+ */
+ rich_text: {
+ /**
+ * @description Optional text styling annotations (bold, italic, etc.).
+ * @default null
+ */
+ annotations: {
+ /**
+ * Bold
+ * @description Whether the text is bold.
+ * @default false
+ */
+ bold: boolean;
+ /**
+ * Code
+ * @description Whether the text is formatted as inline code.
+ * @default false
+ */
+ code: boolean;
+ /**
+ * BlockColor
+ * @description Color of the text or background.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Italic
+ * @description Whether the text is italic.
+ * @default false
+ */
+ italic: boolean;
+ /**
+ * Strikethrough
+ * @description Whether the text has strikethrough.
+ * @default false
+ */
+ strikethrough: boolean;
+ /**
+ * Underline
+ * @description Whether the text is underlined.
+ * @default false
+ */
+ underline: boolean;
+ } | null;
+ /**
+ * TextContent
+ * @description The text content object.
+ */
+ text: {
+ /**
+ * Content
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
+ */
+ content: string;
+ /**
+ * @description Optional link for the text.
+ * @default null
+ */
+ link: {
+ /**
+ * Url
+ * @description The URL the text links to.
+ */
+ url: string;
+ } | null;
+ };
+ /**
+ * Type
+ * @description Type of rich text. Currently only 'text' is supported for input.
+ * @default text
+ * @constant
+ */
+ type: "text";
+ }[];
+ };
+ /**
+ * Object
+ * @description Always 'block'.
+ * @default block
+ * @constant
+ */
+ object: "block";
+ /**
+ * Type
+ * @description Block type.
+ * @default bulleted_list_item
+ * @constant
+ */
+ type: "bulleted_list_item";
+ } | {
+ /**
+ * ListItemInput
+ * @description Numbered list item content.
+ */
+ numbered_list_item: {
+ /**
+ * BlockColor
+ * @description Color of the list item.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Rich Text
+ * @description Array of rich text objects for the list item text.
+ */
+ rich_text: {
+ /**
+ * @description Optional text styling annotations (bold, italic, etc.).
+ * @default null
+ */
+ annotations: {
+ /**
+ * Bold
+ * @description Whether the text is bold.
+ * @default false
+ */
+ bold: boolean;
+ /**
+ * Code
+ * @description Whether the text is formatted as inline code.
+ * @default false
+ */
+ code: boolean;
+ /**
+ * BlockColor
+ * @description Color of the text or background.
+ * @default default
+ * @enum {string}
+ */
+ 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";
+ /**
+ * Italic
+ * @description Whether the text is italic.
+ * @default false
+ */
+ italic: boolean;
+ /**
+ * Strikethrough
+ * @description Whether the text has strikethrough.
+ * @default false
+ */
+ strikethrough: boolean;
+ /**
+ * Underline
+ * @description Whether the text is underlined.
+ * @default false
+ */
+ underline: boolean;
+ } | null;
+ /**
+ * TextContent
+ * @description The text content object.
+ */
+ text: {
+ /**
+ * Content
+ * @description The actual text content. CRITICAL: Maximum 2000 characters per text object.
+ */
+ content: string;
+ /**
+ * @description Optional link for the text.
+ * @default null
+ */
+ link: {
+ /**
+ * Url
+ * @description The URL the text links to.
+ */
+ url: string;
+ } | null;
+ };
+ /**
+ * Type
+ * @description Type of rich text. Currently only 'text' is supported for input.
+ * @default text
+ * @constant
+ */
+ type: "text";
+ }[];
+ };
+ /**
+ * Object
+ * @description Always 'block'.
+ * @default block
+ * @constant
+ */
+ object: "block";
+ /**
+ * Type
+ * @description Block type.
+ * @default numbered_list_item
+ * @constant
+ */
+ type: "numbered_list_item";
+ })[];
+};"
+`;
diff --git a/ts/packages/cli/test/src/generation/typescript/generate-type-from-json-schema.test.ts b/ts/packages/cli/test/src/generation/typescript/generate-type-from-json-schema.test.ts
new file mode 100644
index 000000000..04bd9c0c3
--- /dev/null
+++ b/ts/packages/cli/test/src/generation/typescript/generate-type-from-json-schema.test.ts
@@ -0,0 +1,78 @@
+import { describe, expect, it } from '@effect/vitest';
+import { Effect } from 'effect';
+import { generateTypeFromJsonSchema } from 'src/generation/typescript/generate-type-from-json-schema';
+import { assertTypeScriptIsValid } from 'test/__utils__/typescript-compiler';
+
+// Import fixtures
+import notionDeleteBlock from 'test/__fixtures__/notion-delete-block.json';
+import notionArchivePage from 'test/__fixtures__/notion-archive-page.json';
+import notionCreateComment from 'test/__fixtures__/notion-create-comment.json';
+import notionAppendTextBlocks from 'test/__fixtures__/notion-append-text-blocks.json';
+
+describe('generateTypeFromJsonSchema', () => {
+ describe('control group - simple schemas without discriminator', () => {
+ it.effect(
+ 'should generate type for NOTION_DELETE_BLOCK (simple single property)',
+ Effect.fn(function* () {
+ const result = yield* generateTypeFromJsonSchema(
+ 'NOTION_DELETE_BLOCK_INPUT',
+ notionDeleteBlock.input_parameters
+ );
+
+ expect(result).toContain('type NOTION_DELETE_BLOCK_INPUT');
+ expect(result).toContain('block_id');
+ expect(result).toMatchSnapshot();
+ assertTypeScriptIsValid({ files: { 'index.ts': result } });
+ })
+ );
+
+ it.effect(
+ 'should generate type for NOTION_ARCHIVE_NOTION_PAGE (two properties)',
+ Effect.fn(function* () {
+ const result = yield* generateTypeFromJsonSchema(
+ 'NOTION_ARCHIVE_NOTION_PAGE_INPUT',
+ notionArchivePage.input_parameters
+ );
+
+ expect(result).toContain('type NOTION_ARCHIVE_NOTION_PAGE_INPUT');
+ expect(result).toContain('page_id');
+ expect(result).toContain('archive');
+ expect(result).toMatchSnapshot();
+ assertTypeScriptIsValid({ files: { 'index.ts': result } });
+ })
+ );
+
+ it.effect(
+ 'should generate type for NOTION_CREATE_COMMENT (moderate complexity with nested objects)',
+ Effect.fn(function* () {
+ const result = yield* generateTypeFromJsonSchema(
+ 'NOTION_CREATE_COMMENT_INPUT',
+ notionCreateComment.input_parameters
+ );
+
+ expect(result).toContain('type NOTION_CREATE_COMMENT_INPUT');
+ expect(result).toContain('comment');
+ expect(result).toMatchSnapshot();
+ assertTypeScriptIsValid({ files: { 'index.ts': result } });
+ })
+ );
+ });
+
+ describe('problematic schema - discriminator with $defs references', () => {
+ it.effect(
+ 'should generate type for NOTION_APPEND_TEXT_BLOCKS (discriminator with oneOf)',
+ Effect.fn(function* () {
+ const result = yield* generateTypeFromJsonSchema(
+ 'NOTION_APPEND_TEXT_BLOCKS_INPUT',
+ notionAppendTextBlocks.input_parameters
+ );
+
+ expect(result).toContain('type NOTION_APPEND_TEXT_BLOCKS_INPUT');
+ expect(result).toContain('block_id');
+ expect(result).toContain('children');
+ expect(result).toMatchSnapshot();
+ assertTypeScriptIsValid({ files: { 'index.ts': result } });
+ })
+ );
+ });
+});