Skip to content

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

Open
he-yufeng wants to merge 2 commits into
google:mainfrom
he-yufeng:fix/gemini-schema-const
Open

fix(tools): preserve const schemas for Gemini#5656
he-yufeng wants to merge 2 commits into
google:mainfrom
he-yufeng:fix/gemini-schema-const

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

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

google-cla Bot commented May 11, 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.

@rohityan rohityan self-assigned this May 12, 2026
@rohityan rohityan added tools [Component] This issue is related to tools request clarification [Status] The maintainer need clarification or more information from the author labels May 12, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @he-yufeng , Thank you for your contribution! It appears you haven't yet signed the Contributor License Agreement (CLA). Please visit https://cla.developers.google.com/ to complete the signing process. Once the CLA is signed, we'll be able to proceed with the review of your PR. Thank you!

@he-yufeng he-yufeng force-pushed the fix/gemini-schema-const branch from fb69943 to 521bbf4 Compare May 12, 2026 06:17
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Thanks for the reminder. The CLA has been signed, and I rebased the branch onto the latest main. The cla/google and header-check checks are now passing.

@he-yufeng he-yufeng force-pushed the fix/gemini-schema-const branch 2 times, most recently from 321f8af to 30df388 Compare May 15, 2026 05:56
@he-yufeng

Copy link
Copy Markdown
Contributor Author

Rebased onto current main and force-pushed 2b39f17. Local validation: py_compile passed; focused Gemini schema const regression passed; pyink, isort, and git diff --check passed.

@he-yufeng he-yufeng force-pushed the fix/gemini-schema-const branch from 30df388 to 2b39f17 Compare May 27, 2026 10:25
@rohityan rohityan added needs review [Status] The PR/issue is awaiting review from the maintainer and removed request clarification [Status] The maintainer need clarification or more information from the author labels May 29, 2026
@rohityan rohityan requested a review from wyf7107 May 29, 2026 18:47
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @wyf7107, could you please review this.

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

Labels

needs review [Status] The PR/issue is awaiting review from the maintainer tools [Component] This issue is related to tools

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.

2 participants