Skip to content

fix(tool-api): ensure object schemas always include properties field#160

Merged
yishuiliunian merged 1 commit into
mainfrom
worktree-piped-snuggling-wreath
May 15, 2026
Merged

fix(tool-api): ensure object schemas always include properties field#160
yishuiliunian merged 1 commit into
mainfrom
worktree-piped-snuggling-wreath

Conversation

@yishuiliunian
Copy link
Copy Markdown
Contributor

Summary

  • OpenAI/Gemini APIs reject function schemas where type=object lacks a properties field
  • schemars generates bare {"type":"object"} for empty structs (e.g. EnterPlanModeParams)
  • Added recursive normalization pass in normalize_schema() that inserts "properties":{} for all object-typed nodes

Changes

  • crates/loopal-tool-api/src/schema_normalize.rs — new ensure_object_properties_recursive() function
  • crates/loopal-tool-api/tests/suite/schema_normalize_test.rs — 5 new test cases

Test plan

  • bazel test //crates/loopal-tool-api:loopal-tool-api_test passes
  • bazel build //crates/loopal-tool-api:loopal-tool-api --config=clippy passes
  • CI passes

OpenAI/Gemini APIs reject function schemas where type=object lacks
a properties field. schemars generates bare {"type":"object"} for
empty structs (e.g. EnterPlanModeParams). Add recursive normalization
pass that inserts "properties":{} for all object-typed nodes.
@yishuiliunian yishuiliunian merged commit 2f7c0bb into main May 15, 2026
4 checks passed
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