Skip to content

OpenAPI schema depth truncation rejects valid nested Notion titles #3267

Closed

Description

@lildesert

OpenAPI schema depth truncation rejects valid nested Notion titles

Link to a minimal reproduction

lildesert/eve-openapi-title-repro

The reproduction was initialized with eve@0.53.1 init ., pins the published eve@0.53.1 package, and includes a lockfile. npm's latest tag resolved to 0.53.1 when checked on September 11, 2026.

Steps to reproduce

  1. Clone the reproduction repository.
  2. Use Node.js 24 and pnpm 11.25.0.
  3. Run pnpm install --frozen-lockfile.
  4. Run pnpm repro.

title.test.mjs contains two tests with explicit inputs and assertions. It loads a defineOpenAPIConnection through the installed package's internal OpenApiConnectionClient and calls the generated createPage tool's own validator. This tests schema generation and validation directly, without starting an agent session or executing an HTTP request. It requires no credentials or model call.

The valid input is:

{
  "body": {
    "properties": {
      "Name": {
        "title": [{ "text": { "content": "Upload attendee data" } }]
      }
    }
  }
}

Current vs. expected behavior

Current: the generated validator rejects this valid title with Invalid input: more than one option matched. Both alternatives of the nested rich-text oneOf have become {} in the generated schema. As a result, a value matches both alternatives and fails exclusive-union validation. This blocks valid page-creation input before the HTTP request.

Expected: the string title is accepted, while a title with numeric text.content is rejected. Schema conversion should preserve the distinct constraints of deeply nested alternatives.

The numeric input is already rejected in the reproduction; the failing assertion is the valid title.

eve version

eve@0.53.1, installed from npm and pinned in the reproduction lockfile. This was the latest release when the reproduction was rerun on September 11, 2026. I have not identified a last known-good version.

Environment

OS: macOS 26.6.2 (arm64)
Node.js: v24.14.0
Package manager: pnpm 11.25.0
eve info: v0.53.1; nested agent layout; compile ready; 0 errors, 0 warnings

Where does the bug occur?

Other: runtime OpenAPI tool-input schema conversion and validation. The reproduction runs locally without starting a server.

Build and runtime logs

✖ accepts a valid Notion page title
✔ rejects a title with numeric text content
ℹ tests 2
ℹ pass 1
ℹ fail 1

The validation issue has outer path ["body", "properties", "Name"] and this nested error:

{
  "code": "invalid_union",
  "errors": [],
  "inclusive": false,
  "matches": [0, 1],
  "path": ["title", 0],
  "message": "Invalid input: more than one option matched"
}

The first test's assert.equal(result.issues, undefined) fails, and pnpm repro exits with code 1. Node's test runner prints the complete validation error, including the nested union error above. Timings are omitted from the summary here.

Suggested implementation scope

Preserve validation constraints when converting deeply nested OpenAPI schemas, while keeping recursive references finite. Acceptance criteria:

  • Accept the valid title in the reproduction.
  • Continue rejecting numeric text.content.
  • Keep recursive schemas finite and preserve the existing annotation normalization.

I have a local, uncommitted prototype, but no PR has been opened. Would maintainers support a fix at the OpenAPI schema-conversion boundary, and is there a preferred approach?

Additional context

This was encountered when creating a Notion backlog page through an OpenAPI connection. The fixture reduces the property/rich-text union nesting to isolate the failure.

main at dea8cd8 also retains the depth-12 truncation. The emitted [{}, {}] alternatives in the published-package reproduction explain why a structurally valid schema can reject the valid input.

I searched issues, PRs, and discussions for OpenAPI, Notion, schema truncation, MAX_DEREF_DEPTH, derefSchema, rich text, and oneOf. The closest reports describe different behavior:

Activity

  1. roboeve commented on Oct 15, 2026

    @roboeve
    Contributor

    Confirmed on current origin/main (bc4edd9e07e64ecac1a3b12ad6c672d87ee39543) with a Vitest regression test adapted from the linked minimal fixture. The valid string title is rejected at body.properties.Name.title[0]; the current validator reports that the nested oneOf matches 2 subschemas. The numeric text.content case remains rejected.

    This affects OpenAPI connection users whose deeply nested schemas include unions, including this Notion-style createPage input. The relevant path is packages/eve/src/runtime/connections/openapi-client.ts (request-body schemas go through derefSchema) and packages/eve/src/runtime/connections/openapi-schema.ts: objects deeper than MAX_DEREF_DEPTH (12) are replaced with {}, so the nested rich-text $ref alternatives lose their distinct constraints. I found no other matching open or closed issue.

    The next useful check is to preserve both alternatives while keeping recursive refs finite, then rerun this valid-title/invalid-numeric fixture and the existing recursive-schema test.

  2. roboeve commented on Oct 15, 2026

    @roboeve
    Contributor

    Repro pinned in #4883 (strict it.fails): derefSchema spends its 12-level depth budget on arrays, property maps, and $ref hops, so the rich-text oneOf branches are truncated to {} and both match.

    Repro: #4883
    Regressed in: not a recent regression; the depth-12 truncation dates to the initial commit and still fails on main (bc4edd9e0).

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions