Skip to content

fix: keep title keys inside OpenAPI singular example values - #12313

Closed
LHMQ878 wants to merge 7 commits into
deepset-ai:mainfrom
LHMQ878:fix-keep-title-inside-openapi-example
Closed

fix: keep title keys inside OpenAPI singular example values#12313
LHMQ878 wants to merge 7 commits into
deepset-ai:mainfrom
LHMQ878:fix-keep-title-inside-openapi-example

Conversation

@LHMQ878

@LHMQ878 LHMQ878 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to fix: don't strip title when it is a name, not a schema keyword #12219: treat OpenAPI 3.0 singular example as instance data in _DATA_SCHEMA_KEYWORDS, same as examples / default / const / enum.
  • Keeps nested title keys carried via Pydantic json_schema_extra={example: ...} when building tool schemas.
  • Adds a unit fixture that discriminates singular example and a public-API regression through create_tool_from_function.

Context

Flagged by @percymcn on #12219 after re-checking the post-merge 3.1.0.dev build.

Test plan

  • test_remove_title_from_schema_keeps_instance_data passes with singular example
  • test_from_function_with_openapi_example_containing_title_key passes
  • Existing title-stripping controls (items / propertyNames) still remove schema-level title

LHMQ878 and others added 7 commits August 3, 2026 02:32
deepset-ai#12037 stopped `_remove_title_from_schema` from misreading the keys of a
`properties` mapping as schema keywords. The same reasoning applies to five
more keywords whose values are keyed by user-chosen names, and to three whose
values are instance data rather than subschemas:

- `$defs`, `definitions`: an entry named `title` was deleted, leaving every
  `$ref` that pointed at it dangling. Pydantic keys `$defs` by class name, so
  a nested model named `title` reaches this path through the public API and
  the resulting schema fails validation with `PointerToNowhere`.
- `patternProperties`, `dependentSchemas`, `dependentRequired`: a rule keyed
  on the property name / regex `title` was silently dropped.
- `default`, `const`, `enum`: a `title` key inside one of these is part of the
  *value*. A default of `{"title": "Untitled", "width": 80}` was emitted as
  `{"width": 80}`, changing the tool's contract.

Keywords whose value is a genuine subschema (`items`, `propertyNames`,
`additionalProperties`, `anyOf`, ...) keep losing their `title` as before;
a test guards that direction too.
Follow up deepset-ai#12219: treat OpenAPI 3.0 example the same as examples so nested title keys survive tool schema stripping.
@LHMQ878
LHMQ878 requested a review from a team as a code owner August 12, 2026 04:08
@LHMQ878
LHMQ878 requested review from davidsbatista and removed request for a team August 12, 2026 04:08
@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

@LHMQ878 is attempting to deploy a commit to the deepset Team on Vercel.

A member of the Team first needs to authorize it.

@LHMQ878

LHMQ878 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Note: this branch was parented on the pre-squash tip of #12219, so GitHub is replaying that PR's commits. I'll rebase onto current main and force-push a clean single-commit follow-up as soon as the fork can sync (needs workflow scope).

@LHMQ878

LHMQ878 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor Author

Closing temporarily: branch was based on the pre-squash tip of #12219 so the PR incorrectly replayed that history. Will reopen a clean single-commit follow-up rebased on current main.

@LHMQ878 LHMQ878 closed this Aug 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants