Skip to content

Infer scalar type from anyOf members for optional parameters - #3093

Closed
DavidLeeGarrett wants to merge 1 commit into
googleapis:mainfrom
DavidLeeGarrett:fix-3060-optional-scalar-schema-type
Closed

DavidLeeGarrett wants to merge 1 commit into
googleapis:mainfrom
DavidLeeGarrett:fix-3060-optional-scalar-schema-type

Conversation

@DavidLeeGarrett

Copy link
Copy Markdown

Optional scalar parameters (e.g. int | None) produced "type": "object" in parameters_json_schema because pydantic emits anyOf without a top-level type and the Vertex fallback hardcoded "object". Now the type is inferred from the anyOf members when they share a single non-null type, falling back to "object" only for heterogeneous members. Adds test_function_with_optional_scalar_params.

Fixes #3060.

Optional scalar parameters (e.g. int | None) produced 'type': 'object'
in parameters_json_schema because pydantic emits anyOf without a
top-level type and the Vertex fallback hardcoded 'object'. Now the type
is inferred from the anyOf members when they share a single non-null
type, falling back to 'object' only for heterogeneous members.

Fixes googleapis#3060
@google-cla

google-cla Bot commented Oct 9, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Venkaiahbabuneelam

Copy link
Copy Markdown

Hi @DavidLeeGarrett, Kindly please resolve the conflicts
Thanks

@github-actions

Copy link
Copy Markdown

This pull request has been marked as stale because it has been inactive for 14 days with no activity. It will be closed in 2 days if no further activity occurs.

@github-actions

Copy link
Copy Markdown

This pull request was closed because it has been inactive for 16 days. Please reopen or submit a new PR if you need further assistance. Thanks!

@github-actions github-actions Bot closed this Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Callable tools: optional scalar parameters (int | None) get "type": "object" in parameters_json_schema, so Gemini sends {}

2 participants