diff --git a/internal/util/gemini_schema.go b/internal/util/gemini_schema.go index b8d07bf4d9..e0caab8222 100644 --- a/internal/util/gemini_schema.go +++ b/internal/util/gemini_schema.go @@ -431,6 +431,7 @@ func removeUnsupportedKeywords(jsonStr string) string { "$schema", "$defs", "definitions", "const", "$ref", "$id", "additionalProperties", "propertyNames", "patternProperties", // Gemini doesn't support these schema keywords "enumTitles", "prefill", // Claude/OpenCode schema metadata fields unsupported by Gemini + "deprecated", // JSON Schema keyword not supported by Gemini API ) deletePaths := make([]string, 0) diff --git a/internal/util/gemini_schema_test.go b/internal/util/gemini_schema_test.go index bb06e95673..d8f318c3bd 100644 --- a/internal/util/gemini_schema_test.go +++ b/internal/util/gemini_schema_test.go @@ -921,6 +921,38 @@ func TestCleanJSONSchemaForGemini_RemovesGeminiUnsupportedMetadataFields(t *test compareJSON(t, expected, result) } +func TestCleanJSONSchemaForGemini_RemovesDeprecatedField(t *testing.T) { + input := `{ + "type": "object", + "properties": { + "old_field": { + "type": "string", + "deprecated": true + }, + "deprecated": { + "type": "string", + "description": "property named deprecated should not be removed" + } + } + }` + + expected := `{ + "type": "object", + "properties": { + "old_field": { + "type": "string" + }, + "deprecated": { + "type": "string", + "description": "property named deprecated should not be removed" + } + } + }` + + result := CleanJSONSchemaForGemini(input) + compareJSON(t, expected, result) +} + func TestRemoveExtensionFields(t *testing.T) { tests := []struct { name string