diff --git a/internal/runtime/executor/antigravity_executor_buildrequest_test.go b/internal/runtime/executor/antigravity_executor_buildrequest_test.go index ff4f69f1..b5329d78 100644 --- a/internal/runtime/executor/antigravity_executor_buildrequest_test.go +++ b/internal/runtime/executor/antigravity_executor_buildrequest_test.go @@ -300,17 +300,20 @@ func buildRequestBodyFromPayload(t *testing.T, modelName string) map[string]any "parametersJsonSchema": { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "root-schema", + "$comment": "root comment should be removed", "type": "object", "properties": { "$id": {"type": "string"}, "arg": { "type": "object", + "$comment": "nested comment should be removed", "prefill": "hello", "properties": { "mode": { "type": "string", "deprecated": true, "enum": ["a", "b"], + "enumDescriptions": ["Alpha", "Beta"], "enumTitles": ["A", "B"] } } @@ -389,6 +392,9 @@ func assertSchemaSanitizedAndPropertyPreserved(t *testing.T, params map[string]a if _, ok := params["$id"]; ok { t.Fatalf("root $id should be removed from schema") } + if _, ok := params["$comment"]; ok { + t.Fatalf("root $comment should be removed from schema") + } if _, ok := params["patternProperties"]; ok { t.Fatalf("patternProperties should be removed from schema") } @@ -408,6 +414,9 @@ func assertSchemaSanitizedAndPropertyPreserved(t *testing.T, params map[string]a if _, ok := arg["prefill"]; ok { t.Fatalf("prefill should be removed from nested schema") } + if _, ok := arg["$comment"]; ok { + t.Fatalf("nested $comment should be removed from schema") + } argProps, ok := arg["properties"].(map[string]any) if !ok { @@ -420,6 +429,9 @@ func assertSchemaSanitizedAndPropertyPreserved(t *testing.T, params map[string]a if _, ok := mode["enumTitles"]; ok { t.Fatalf("enumTitles should be removed from nested schema") } + if _, ok := mode["enumDescriptions"]; ok { + t.Fatalf("enumDescriptions should be removed from nested schema") + } if _, ok := mode["deprecated"]; ok { t.Fatalf("deprecated should be removed from nested schema") } diff --git a/internal/util/gemini_schema.go b/internal/util/gemini_schema.go index 4cc946d5..010669a8 100644 --- a/internal/util/gemini_schema.go +++ b/internal/util/gemini_schema.go @@ -440,7 +440,7 @@ func removeUnsupportedKeywords(jsonStr string) string { keywords := append(unsupportedConstraints, "$schema", "$defs", "definitions", "const", "$ref", "$id", "additionalProperties", "propertyNames", "patternProperties", // Gemini doesn't support these schema keywords - "enumTitles", "prefill", "deprecated", // Schema metadata fields unsupported by Gemini + "$comment", "enumDescriptions", "enumTitles", "prefill", "deprecated", // Schema metadata fields unsupported by Gemini ) deletePaths := make([]string, 0) diff --git a/internal/util/gemini_schema_test.go b/internal/util/gemini_schema_test.go index 92bce013..bb581cdc 100644 --- a/internal/util/gemini_schema_test.go +++ b/internal/util/gemini_schema_test.go @@ -874,15 +874,18 @@ func TestCleanJSONSchemaForGemini_RemovesGeminiUnsupportedMetadataFields(t *test input := `{ "$schema": "http://json-schema.org/draft-07/schema#", "$id": "root-schema", + "$comment": "root comment should be removed", "type": "object", "properties": { "payload": { "type": "object", + "$comment": "nested comment should be removed", "prefill": "hello", "properties": { "mode": { "type": "string", "enum": ["a", "b"], + "enumDescriptions": ["Alpha", "Beta"], "enumTitles": ["A", "B"] } }, @@ -893,6 +896,14 @@ func TestCleanJSONSchemaForGemini_RemovesGeminiUnsupportedMetadataFields(t *test "$id": { "type": "string", "description": "property name should not be removed" + }, + "$comment": { + "type": "string", + "description": "property name should not be removed" + }, + "enumDescriptions": { + "type": "array", + "description": "property name should not be removed" } } }` @@ -913,6 +924,14 @@ func TestCleanJSONSchemaForGemini_RemovesGeminiUnsupportedMetadataFields(t *test "$id": { "type": "string", "description": "property name should not be removed" + }, + "$comment": { + "type": "string", + "description": "property name should not be removed" + }, + "enumDescriptions": { + "type": "array", + "description": "property name should not be removed" } } }`