fix(gemini): expand schema cleaning to cover all unsupported JSON Schema fields#88
Open
weijiafu14 wants to merge 1 commit into1rgs:mainfrom
Open
fix(gemini): expand schema cleaning to cover all unsupported JSON Schema fields#88weijiafu14 wants to merge 1 commit into1rgs:mainfrom
weijiafu14 wants to merge 1 commit into1rgs:mainfrom
Conversation
…ema fields The current clean_gemini_schema() only removes additionalProperties, default, and some format values. But Gemini rejects many more JSON Schema fields, causing 400 errors on tools with complex schemas (e.g. Claude Code's built-in tools use oneOf, allOf, nullable, pattern, etc.). This expands the cleaning to cover 30+ unsupported fields including: - Validation: format, minimum, maximum, pattern, minLength, maxLength, etc. - Metadata: default, examples, const, title - Composition: oneOf, anyOf, allOf, not - Extensions: $ref, $schema, nullable, propertyNames, etc. Reference: https://github.com/weijiafu14/gemini-claude-bridge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
clean_gemini_schema()currently only removes 3 fields (additionalProperties,default, and someformatvalues). But Gemini API rejects many more JSON Schema fields, causing 400 errors when Claude Code's built-in tools have complex schemas.For example, Claude Code tools use
oneOf,allOf,nullable,pattern,$ref, etc. — all of which Gemini rejects.Related issues: #11, #13, #52, #87
Fix
Expand the cleaning to cover 30+ unsupported fields:
format,minimum,maximum,pattern,minLength,maxLength,minItems,maxItems,exclusiveMinimum,exclusiveMaximumdefault,examples,const,titleoneOf,anyOf,allOf,not$ref,$schema,$id,$comment,nullable,propertyNames,patternProperties,unevaluatedProperties,dependentSchemas,dependentRequired,if,then,elseThis is extracted from gemini-claude-bridge, a production-tested Gemini ↔ Claude converter.
Test
No behavior change for currently-working tools (we only remove fields that Gemini ignores or rejects). Fixes tools that previously caused 400 errors due to unsupported schema fields.