Skip to content

fix(tools): preserve const schemas for Gemini#5656

Open
he-yufeng wants to merge 1 commit intogoogle:mainfrom
he-yufeng:fix/gemini-schema-const
Open

fix(tools): preserve const schemas for Gemini#5656
he-yufeng wants to merge 1 commit intogoogle:mainfrom
he-yufeng:fix/gemini-schema-const

Conversation

@he-yufeng
Copy link
Copy Markdown

Summary

  • accept JSON Schema const in the Gemini schema conversion path
  • map const to a single-value enum before building the Gemini Schema, since the target type has no native const field
  • add coverage for constant string schemas

Fixes #5653

To verify

  • uv run --extra test python -m pytest tests\unittests\tools\test_gemini_schema_util.py -q
  • uv run --extra dev pyink --check src\google\adk\tools\_gemini_schema_util.py tests\unittests\tools\test_gemini_schema_util.py
  • uv run python -m py_compile src\google\adk\tools\_gemini_schema_util.py tests\unittests\tools\test_gemini_schema_util.py
  • git diff --check

@google-cla
Copy link
Copy Markdown

google-cla Bot commented May 11, 2026

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.

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.

The _ExtendedJSONSchema class should support const as it's a valid JSON Schema Draft-07+ keyword.

1 participant