Skip to content

feat(integration): add 14 Notion functions#592

Open
TooonyChen wants to merge 1 commit intoaipotheosis-labs:mainfrom
TooonyChen:feat/notion_14_functions
Open

feat(integration): add 14 Notion functions#592
TooonyChen wants to merge 1 commit intoaipotheosis-labs:mainfrom
TooonyChen:feat/notion_14_functions

Conversation

@TooonyChen
Copy link
Contributor

@TooonyChen TooonyChen commented Aug 31, 2025

🏷️ Ticket

notion ticket

📝 Description

This PR significantly expands the Notion integration by adding 14 new functions and fixing critical schema issues to ensure proper AI interaction with the Notion API.

🆕 New Functions Added

  • Database Management: CREATE_DATABASE, GET_DATABASE, UPDATE_DATABASE, QUERY_DATABASE
  • Block Operations: APPEND_BLOCK_CHILDREN, GET_BLOCK, GET_BLOCK_CHILDREN, UPDATE_BLOCK, DELETE_BLOCK
  • Advanced Page Operations: GET_PAGE_PROPERTY, UPDATE_PAGE_PROPERTIES
  • Comments: CREATE_COMMENT, GET_COMMENT, GET_COMMENTS
  • Did a change in GET_PAGE to change the filter_properties from array to string base on the notion API docs

🎥 Demo (if applicable)

📸 Screenshots (if applicable)

fuzzy prompt and test result are here: notion page

✅ Checklist

  • I have signed the Contributor License Agreement (CLA) and read the contributing guide (required)
  • I have linked this PR to an issue or a ticket (required)
  • I have updated the documentation related to my change if needed
  • I have updated the tests accordingly (required for a bug fix or a new feature)
  • All checks on CI passed

Summary by cubic

Adds 14 Notion integration functions for databases, blocks, pages, and comments, and fixes the GET_PAGE schema for filter_properties. This brings broader API coverage and aligns parameters with Notion’s spec.

  • New Features

    • Databases: NOTION__CREATE_DATABASE, NOTION__GET_DATABASE, NOTION__UPDATE_DATABASE, NOTION__QUERY_DATABASE
    • Blocks: NOTION__APPEND_BLOCK_CHILDREN, NOTION__GET_BLOCK, NOTION__GET_BLOCK_CHILDREN, NOTION__UPDATE_BLOCK, NOTION__DELETE_BLOCK
    • Pages: NOTION__GET_PAGE_PROPERTY, NOTION__UPDATE_PAGE_PROPERTIES
    • Comments: NOTION__CREATE_COMMENT, NOTION__GET_COMMENT, NOTION__GET_COMMENTS
  • Migration

    • GET_PAGE.filter_properties is now a string (was array). For multiple values, repeat the query param (e.g., ?filter_properties=iAk8&filter_properties=b7dh).

Summary by CodeRabbit

  • New Features

    • Expanded Notion integration with new endpoints for databases (create, get, update, query), blocks (get, update, delete, append children, list children), pages (get property, update properties), and comments (create, get, list).
    • Standardized request headers and parameter schemas across endpoints.
  • Refactor

    • Updated page retrieval query: filter_properties now accepts a single string value instead of an array. Update any usage accordingly.

@TooonyChen TooonyChen had a problem deploying to CICD_FOR_FORKED_REPO August 31, 2025 12:01 — with GitHub Actions Failure
@TooonyChen TooonyChen had a problem deploying to CICD_FOR_FORKED_REPO August 31, 2025 12:01 — with GitHub Actions Failure
@vercel
Copy link

vercel bot commented Aug 31, 2025

Someone is attempting to deploy a commit to the Proxy Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 31, 2025

Walkthrough

Expanded Notion REST coverage in backend/apps/notion/functions.json by adding endpoints for databases, blocks, page properties, and comments. Modified NOTION__GET_PAGE query parameter filter_properties from array to single string.

Changes

Cohort / File(s) Summary of Changes
Endpoint additions: databases
backend/apps/notion/functions.json
Added NOTION__CREATE_DATABASE, NOTION__GET_DATABASE, NOTION__UPDATE_DATABASE, NOTION__QUERY_DATABASE with headers, path params, and request/response schemas.
Endpoint additions: blocks
backend/apps/notion/functions.json
Added NOTION__APPEND_BLOCK_CHILDREN, NOTION__GET_BLOCK, NOTION__GET_BLOCK_CHILDREN, NOTION__UPDATE_BLOCK, NOTION__DELETE_BLOCK.
Endpoint additions: pages/properties
backend/apps/notion/functions.json
Added NOTION__GET_PAGE_PROPERTY, NOTION__UPDATE_PAGE_PROPERTIES.
Endpoint additions: comments
backend/apps/notion/functions.json
Added NOTION__CREATE_COMMENT, NOTION__GET_COMMENT, NOTION__GET_COMMENTS.
Signature change: pages
backend/apps/notion/functions.json
Updated NOTION__GET_PAGE: query.filter_properties changed from array of strings to single string.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor Client
  participant NotionSvc as Notion Service (functions.json)
  participant NotionAPI as Notion Public API

  Note over Client,NotionAPI: High-level flow for new/updated endpoints

  rect rgba(220,240,255,0.4)
    Client->>NotionSvc: Create/Update/Query Database
    NotionSvc->>NotionAPI: POST/PATCH/GET /databases...
    NotionAPI-->>NotionSvc: Database payload
    NotionSvc-->>Client: Response
  end

  rect rgba(235,255,235,0.4)
    Client->>NotionSvc: Get/Update/Delete Block<br/>Append Block Children
    NotionSvc->>NotionAPI: GET/PATCH/DELETE /blocks...<br/>PATCH /blocks/{id}/children
    NotionAPI-->>NotionSvc: Block/Children payload
    NotionSvc-->>Client: Response
  end

  rect rgba(255,245,220,0.5)
    Client->>NotionSvc: Get Page / Get Page Property / Update Page
    Note right of NotionSvc: filter_properties now single string
    NotionSvc->>NotionAPI: GET /pages/{id}[?filter_properties]<br/>GET /pages/{id}/properties/{prop_id}<br/>PATCH /pages/{id}
    NotionAPI-->>NotionSvc: Page/Property payload
    NotionSvc-->>Client: Response
  end

  rect rgba(255,235,245,0.5)
    Client->>NotionSvc: Create/Get Comments
    NotionSvc->>NotionAPI: POST /comments, GET /comments/{id}|/comments
    NotionAPI-->>NotionSvc: Comment(s)
    NotionSvc-->>Client: Response
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Suggested reviewers

  • jiwei-aipolabs

Poem

I thump my paws on fields of JSON green,
New routes sprout up—so many to be seen!
Blocks hop, pages turn, databases bloom,
Comments chirp softly, clearing schema gloom.
One filter now—just singular delight—
I nibble docs and bound into the night. 🐇✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore or @coderabbit ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@recurseml
Copy link

recurseml bot commented Aug 31, 2025

Review by RecurseML

🔍 Review performed on 2c12d12..533c6ef

✨ No bugs found, your code is sparkling clean

⏭️ Files skipped (low suspicion) (1)

backend/apps/notion/functions.json

Need help? Join our Discord

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 5

🧹 Nitpick comments (4)
backend/apps/notion/functions.json (4)

1366-1370: Add page_size bounds for consistency (GET_BLOCK_CHILDREN).

-                        "page_size": {
-                            "type": "integer",
-                            "description": "The number of items from the full list desired in the response. Maximum: 100",
-                            "default": 100
-                        }
+                        "page_size": {
+                            "type": "integer",
+                            "description": "The number of items from the full list desired in the response. Maximum: 100",
+                            "default": 100,
+                            "minimum": 1,
+                            "maximum": 100
+                        }

2146-2148: Add page_size bounds for consistency (GET_COMMENTS).

-                        "page_size": {
-                            "type": "integer",
-                            "description": "The number of items from the full list desired in the response. Maximum: 100"
-                        }
+                        "page_size": {
+                            "type": "integer",
+                            "description": "The number of items from the full list desired in the response. Maximum: 100",
+                            "minimum": 1,
+                            "maximum": 100
+                        }

1284-1285: Nit: Wording.

“contains has_children: true” → “has_children: true”.

-        "description": "Retrieves a Block object using the ID specified. If the block contains has_children: true, use Retrieve block children to get the list of children.",
+        "description": "Retrieves a Block object using the ID specified. If the block has has_children: true, use Retrieve block children to get the list of children.",

1-62: Breaking change: GET_PAGE.filter_properties type changed.

This alters the contract (array → string). If you stick with array (recommended), document migration; if you keep string, add a deprecation notice and update any callers. Also update docs checklist in the PR.

I can generate a migration note and search for impacted call sites if you want.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2c12d12 and 533c6ef.

📒 Files selected for processing (1)
  • backend/apps/notion/functions.json (2 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
backend/apps/*/{app.json,functions.json}

📄 CodeRabbit inference engine (CLAUDE.md)

Each integration in backend/apps/{app_name}/ must have both app.json and functions.json files

Files:

  • backend/apps/notion/functions.json
backend/apps/*/functions.json

📄 CodeRabbit inference engine (CLAUDE.md)

Integration functions.json files must define API endpoints and their schemas

Files:

  • backend/apps/notion/functions.json
backend/apps/**/*.json

📄 CodeRabbit inference engine (CLAUDE.md)

Backend integration definitions should be stored as JSON configs in backend/apps/

Files:

  • backend/apps/notion/functions.json
🔇 Additional comments (4)
backend/apps/notion/functions.json (4)

646-2173: Overall: Strong coverage and consistent schemas.

Great addition of 14 endpoints with clear path/query/header separation and pagination patterns.


1-1: Remove incorrect note about missing app.json: the file backend/apps/notion/app.json is present, so no changes are needed.

Likely an incorrect or invalid review comment.


1609-1612: DELETE /blocks/{block_id} is supported by Notion API since September 10, 2021; safe to merge.


664-668: No update required for Notion-Version default
The default 2022-06-28 is confirmed as the latest stable Notion API version as of August 31 2025 (developers.notion.com)

Comment on lines 34 to 37
"filter_properties": {
"type": "array",
"description": "A list of page property value IDs associated with the page. Use this param to limit the response to a specific page property value or values. To retrieve multiple properties, specify each page property ID. For example: ?filter_properties=iAk8&filter_properties=b7dh.",
"items": {
"type": "string"
}
"type": "string",
"description": "A list of page property value IDs associated with the page. Use this param to limit the response to a specific page property value or values. To retrieve multiple properties, specify each page property ID. For example: ?filter_properties=iAk8&filter_properties=b7dh."
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Revert filter_properties to array (supports repeated query param).

The Notion API allows multiple filter_properties by repeating the param. Modeling as a single string regresses multi-select. Suggest array of strings so the client can expand into repeated params.

-                        "filter_properties": {
-                            "type": "string",
-                            "description": "A list of page property value IDs associated with the page. Use this param to limit the response to a specific page property value or values. To retrieve multiple properties, specify each page property ID. For example: ?filter_properties=iAk8&filter_properties=b7dh."
-                        }
+                        "filter_properties": {
+                            "type": "array",
+                            "description": "Repeatable query param. Provide an array of page property value IDs; the client will send them as repeated filter_properties params.",
+                            "items": { "type": "string" }
+                        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"filter_properties": {
"type": "array",
"description": "A list of page property value IDs associated with the page. Use this param to limit the response to a specific page property value or values. To retrieve multiple properties, specify each page property ID. For example: ?filter_properties=iAk8&filter_properties=b7dh.",
"items": {
"type": "string"
}
"type": "string",
"description": "A list of page property value IDs associated with the page. Use this param to limit the response to a specific page property value or values. To retrieve multiple properties, specify each page property ID. For example: ?filter_properties=iAk8&filter_properties=b7dh."
}
++ b/backend/apps/notion/functions.json
@@ -31,7 +31,10 @@
"filter_properties": {
- "type": "string",
- "description": "A list of page property value IDs associated with the page. Use this param to limit the response to a specific page property value or values. To retrieve multiple properties, specify each page property ID. For example: ?filter_properties=iAk8&filter_properties=b7dh."
"type": "array",
"description": "Repeatable query param. Provide an array of page property value IDs; the client will send them as repeated filter_properties params.",
"items": {
"type": "string"
}
}
🤖 Prompt for AI Agents
In backend/apps/notion/functions.json around lines 34 to 37, the
"filter_properties" schema is defined as a single string but the Notion API
accepts repeated query parameters; change the schema to an array of strings
(e.g., type: "array" with items: { type: "string" }) so the client can serialize
multiple values as repeated query params, and update any description to reflect
that multiple entries are supported.

Comment on lines +1047 to +1054
"filter_properties": {
"type": "string",
"description": "A list of page property value IDs associated with the database. Use this param to limit the response to a specific page property value or values for pages that meet the filter criteria."
}
},
"required": [],
"visible": ["filter_properties"],
"additionalProperties": false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Align QUERY_DATABASE.filter_properties with GET_PAGE (array, not string).

Same reasoning as above; keep behavior consistent and multi-value capable.

-                        "filter_properties": {
-                            "type": "string",
-                            "description": "A list of page property value IDs associated with the database. Use this param to limit the response to a specific page property value or values for pages that meet the filter criteria."
-                        }
+                        "filter_properties": {
+                            "type": "array",
+                            "description": "Repeatable query param. Provide an array of page property value IDs; the client will send them as repeated filter_properties params.",
+                            "items": { "type": "string" }
+                        }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"filter_properties": {
"type": "string",
"description": "A list of page property value IDs associated with the database. Use this param to limit the response to a specific page property value or values for pages that meet the filter criteria."
}
},
"required": [],
"visible": ["filter_properties"],
"additionalProperties": false
"filter_properties": {
"type": "array",
"description": "Repeatable query param. Provide an array of page property value IDs; the client will send them as repeated filter_properties params.",
"items": { "type": "string" }
}
🤖 Prompt for AI Agents
In backend/apps/notion/functions.json around lines 1047 to 1054, the
QUERY_DATABASE parameter "filter_properties" is defined as a string but should
be an array like GET_PAGE to support multiple values; change its schema type
from "string" to "array", add "items": { "type": "string" } (or appropriate ID
type), and update "description" if needed to indicate it accepts multiple values
so behavior is consistent across endpoints.

Comment on lines +1764 to +1867
"properties": {
"type": "object",
"description": "The property values to update for the page. The keys are the names or IDs of the property and the values are property values. If a page property ID is not included, then it is not changed.",
"properties": {
"Name": {
"type": "object",
"description": "Title property for the page",
"properties": {
"title": {
"type": "array",
"description": "Rich text array for title",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["text"],
"default": "text"
},
"text": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The text content"
}
},
"required": ["content"],
"additionalProperties": false
}
},
"required": ["type", "text"],
"additionalProperties": false
}
}
},
"required": ["title"],
"visible": ["title"],
"additionalProperties": false
},
"Status": {
"type": "object",
"description": "Select property for status",
"properties": {
"select": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the select option"
}
},
"required": ["name"],
"visible": ["name"],
"additionalProperties": false
}
},
"required": ["select"],
"visible": ["select"],
"additionalProperties": false
},
"Price": {
"type": "object",
"description": "Number property for price",
"properties": {
"number": {
"type": "number",
"description": "Numeric value"
}
},
"required": ["number"],
"visible": ["number"],
"additionalProperties": false
},
"Available Date": {
"type": "object",
"description": "Date property for available date",
"properties": {
"date": {
"type": "object",
"properties": {
"start": {
"type": "string",
"description": "Start date in ISO 8601 format (YYYY-MM-DD)"
},
"end": {
"type": "string",
"description": "End date in ISO 8601 format (YYYY-MM-DD)"
}
},
"required": ["start"],
"visible": ["start", "end"],
"additionalProperties": false
}
},
"required": ["date"],
"visible": ["date"],
"additionalProperties": false
}
},
"required": [],
"visible": ["Name", "Status", "Price", "Available Date"],
"additionalProperties": true
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Make page property updates generic; avoid hard-coding keys.

Hard-coding Name/Status/Price/Available Date prevents updating arbitrary database schemas.

-                        "properties": {
-                            "type": "object",
-                            "description": "The property values to update for the page. The keys are the names or IDs of the property and the values are property values. If a page property ID is not included, then it is not changed.",
-                            "properties": {
-                                "Name": { ... },
-                                "Status": { ... },
-                                "Price": { ... },
-                                "Available Date": { ... }
-                            },
-                            "required": [],
-                            "visible": ["Name", "Status", "Price", "Available Date"],
-                            "additionalProperties": true
-                        },
+                        "properties": {
+                            "type": "object",
+                            "description": "Arbitrary page properties keyed by name or ID. Values must follow Notion property value schema for the parent database.",
+                            "additionalProperties": true
+                        },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"properties": {
"type": "object",
"description": "The property values to update for the page. The keys are the names or IDs of the property and the values are property values. If a page property ID is not included, then it is not changed.",
"properties": {
"Name": {
"type": "object",
"description": "Title property for the page",
"properties": {
"title": {
"type": "array",
"description": "Rich text array for title",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string",
"enum": ["text"],
"default": "text"
},
"text": {
"type": "object",
"properties": {
"content": {
"type": "string",
"description": "The text content"
}
},
"required": ["content"],
"additionalProperties": false
}
},
"required": ["type", "text"],
"additionalProperties": false
}
}
},
"required": ["title"],
"visible": ["title"],
"additionalProperties": false
},
"Status": {
"type": "object",
"description": "Select property for status",
"properties": {
"select": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the select option"
}
},
"required": ["name"],
"visible": ["name"],
"additionalProperties": false
}
},
"required": ["select"],
"visible": ["select"],
"additionalProperties": false
},
"Price": {
"type": "object",
"description": "Number property for price",
"properties": {
"number": {
"type": "number",
"description": "Numeric value"
}
},
"required": ["number"],
"visible": ["number"],
"additionalProperties": false
},
"Available Date": {
"type": "object",
"description": "Date property for available date",
"properties": {
"date": {
"type": "object",
"properties": {
"start": {
"type": "string",
"description": "Start date in ISO 8601 format (YYYY-MM-DD)"
},
"end": {
"type": "string",
"description": "End date in ISO 8601 format (YYYY-MM-DD)"
}
},
"required": ["start"],
"visible": ["start", "end"],
"additionalProperties": false
}
},
"required": ["date"],
"visible": ["date"],
"additionalProperties": false
}
},
"required": [],
"visible": ["Name", "Status", "Price", "Available Date"],
"additionalProperties": true
},
"properties": {
"type": "object",
"description": "Arbitrary page properties keyed by name or ID. Values must follow Notion property value schema for the parent database.",
"additionalProperties": true
},

Comment on lines +1868 to +1877
"in_trash": {
"type": "boolean",
"description": "Set to true to delete a block. Set to false to restore a block.",
"default": false
},
"archived": {
"type": "boolean",
"description": "Set to true to archive a page. Set to false to restore a page.",
"default": false
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Remove in_trash from writable fields.

in_trash is read-only on pages; setting it has no effect and can mislead callers. archived is the supported control.

-                        "in_trash": {
-                            "type": "boolean",
-                            "description": "Set to true to delete a block. Set to false to restore a block.",
-                            "default": false
-                        },
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
"in_trash": {
"type": "boolean",
"description": "Set to true to delete a block. Set to false to restore a block.",
"default": false
},
"archived": {
"type": "boolean",
"description": "Set to true to archive a page. Set to false to restore a page.",
"default": false
},
"archived": {
"type": "boolean",
"description": "Set to true to archive a page. Set to false to restore a page.",
"default": false
},
🤖 Prompt for AI Agents
In backend/apps/notion/functions.json around lines 1868 to 1877, the schema
exposes "in_trash" as a writable boolean (with description and default) but that
field is read-only on pages and should not be presented as writable; remove the
entire "in_trash" property from the writable fields (or alternatively mark it
explicitly as readOnly: true and remove default) so callers cannot set it,
leaving "archived" as the supported writable control.

Comment on lines +1986 to +2003
"parent": {
"type": "object",
"description": "A page parent object. Either this or a discussion_id is required (not both)",
"properties": {
"page_id": {
"type": "string",
"description": "The ID of the page to comment on"
}
},
"required": ["page_id"],
"visible": ["page_id"],
"additionalProperties": false
},
"discussion_id": {
"type": "string",
"description": "A UUID identifier for a discussion thread. Either this or a parent object is required (not both)"
},
"rich_text": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Enforce mutual exclusivity: parent.page_id XOR discussion_id.

Add oneOf at the body level so exactly one is provided.

                 "body": {
                   "type": "object",
                   "description": "Comment creation parameters",
+                  "oneOf": [
+                    { "required": ["parent"] },
+                    { "required": ["discussion_id"] }
+                  ],
                   "properties": {
                     "parent": {

Also applies to: 1999-2002, 2060-2063

🤖 Prompt for AI Agents
In backend/apps/notion/functions.json around lines 1986-2003 (also apply same
change at 1999-2002 and 2060-2063), add a top-level oneOf for the request body
so exactly one of the two options is accepted: option A requires the parent
object with page_id (and explicitly forbids discussion_id), option B requires
discussion_id (and explicitly forbids parent). Implement the oneOf with two
subschemas—one that lists "required": ["parent"] and disallows discussion_id,
and the other that lists "required": ["discussion_id"] and disallows parent—so
parent.page_id XOR discussion_id is enforced.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

5 issues found across 1 file

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

"items": {
"type": "string"
}
"type": "string",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model filter_properties as an array of strings to support multiple values (repeated query params); using a single string removes multi-value support

Prompt for AI agents
Address the following comment on backend/apps/notion/functions.json at line 35:

<comment>Model filter_properties as an array of strings to support multiple values (repeated query params); using a single string removes multi-value support</comment>

<file context>
@@ -32,11 +32,8 @@
-                            &quot;items&quot;: {
-                                &quot;type&quot;: &quot;string&quot;
-                            }
+                            &quot;type&quot;: &quot;string&quot;,
+                            &quot;description&quot;: &quot;A list of page property value IDs associated with the page. Use this param to limit the response to a specific page property value or values. To retrieve multiple properties, specify each page property ID. For example: ?filter_properties=iAk8&amp;filter_properties=b7dh.&quot;
                         }
</file context>

"visible": ["Name", "Status", "Price", "Available Date"],
"additionalProperties": true
},
"in_trash": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove in_trash from the writable page update schema; it’s a read-only field on pages and will be ignored. Use the archived field to archive/unarchive pages instead

Prompt for AI agents
Address the following comment on backend/apps/notion/functions.json at line 1868:

<comment>Remove in_trash from the writable page update schema; it’s a read-only field on pages and will be ignored. Use the archived field to archive/unarchive pages instead</comment>

<file context>
@@ -644,5 +641,1534 @@
+                            &quot;visible&quot;: [&quot;Name&quot;, &quot;Status&quot;, &quot;Price&quot;, &quot;Available Date&quot;],
+                            &quot;additionalProperties&quot;: true
+                        },
+                        &quot;in_trash&quot;: {
+                            &quot;type&quot;: &quot;boolean&quot;,
+                            &quot;description&quot;: &quot;Set to true to delete a block. Set to false to restore a block.&quot;,
</file context>

"visible": ["page_id"],
"additionalProperties": false
},
"discussion_id": {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enforce mutual exclusivity between parent.page_id and discussion_id using a oneOf constraint at the body level to prevent invalid payloads. (Based on your team's feedback about adding robust Notion functions.)

Prompt for AI agents
Address the following comment on backend/apps/notion/functions.json at line 1999:

<comment>Enforce mutual exclusivity between parent.page_id and discussion_id using a oneOf constraint at the body level to prevent invalid payloads. (Based on your team&#39;s feedback about adding robust Notion functions.)</comment>

<file context>
@@ -644,5 +641,1534 @@
+                            &quot;visible&quot;: [&quot;page_id&quot;],
+                            &quot;additionalProperties&quot;: false
+                        },
+                        &quot;discussion_id&quot;: {
+                            &quot;type&quot;: &quot;string&quot;,
+                            &quot;description&quot;: &quot;A UUID identifier for a discussion thread. Either this or a parent object is required (not both)&quot;
</file context>

},
"in_trash": {
"type": "boolean",
"description": "Set to true to delete a block. Set to false to restore a block.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description refers to 'block' in a page update; replace with 'page' to avoid confusion. (Based on your team's feedback about ensuring correctness in Notion schema.)

Prompt for AI agents
Address the following comment on backend/apps/notion/functions.json at line 1870:

<comment>Description refers to &#39;block&#39; in a page update; replace with &#39;page&#39; to avoid confusion. (Based on your team&#39;s feedback about ensuring correctness in Notion schema.)</comment>

<file context>
@@ -644,5 +641,1534 @@
+                        },
+                        &quot;in_trash&quot;: {
+                            &quot;type&quot;: &quot;boolean&quot;,
+                            &quot;description&quot;: &quot;Set to true to delete a block. Set to false to restore a block.&quot;,
+                            &quot;default&quot;: false
+                        },
</file context>

"start_cursor": {
"type": "string",
"description": "When supplied, returns a page of results starting after the cursor provided. If not supplied, this endpoint will return the first page of results.",
"format": "uuid"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid constraining start_cursor to a UUID; cursors are opaque strings and other endpoints in this file omit a format constraint, so this may reject valid cursors. (Based on your team's feedback about fixing schema issues to ensure proper AI interaction with the Notion API.)

Prompt for AI agents
Address the following comment on backend/apps/notion/functions.json at line 1110:

<comment>Avoid constraining start_cursor to a UUID; cursors are opaque strings and other endpoints in this file omit a format constraint, so this may reject valid cursors. (Based on your team&#39;s feedback about fixing schema issues to ensure proper AI interaction with the Notion API.)</comment>

<file context>
@@ -644,5 +641,1534 @@
+                        &quot;start_cursor&quot;: {
+                            &quot;type&quot;: &quot;string&quot;,
+                            &quot;description&quot;: &quot;When supplied, returns a page of results starting after the cursor provided. If not supplied, this endpoint will return the first page of results.&quot;,
+                            &quot;format&quot;: &quot;uuid&quot;
+                        },
+                        &quot;page_size&quot;: {
</file context>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant