Unified · Split
| @@ -236,7 +236,7 @@ func addAdditionalPropertiesHints(jsonStr string) string { · 235 unmodified lines | ||
| 236 | 236 | |
| 237 | 237 | var unsupportedConstraints = []string{ |
| 238 | 238 | "minLength", "maxLength", "exclusiveMinimum", "exclusiveMaximum", |
| 239 | − "pattern", "minItems", "maxItems", "format", | |
| 239 | + "pattern", "minItems", "maxItems", "uniqueItems", "format", | |
| 240 | 240 | "default", "examples", // Claude rejects these in VALIDATED mode |
| 241 | 241 | } |
| 242 | 242 | |
| @@ -1046,3 +1046,27 @@ func TestRemoveExtensionFields(t *testing.T) { · 1045 unmodified lines | ||
| 1046 | 1046 | }) |
| 1047 | 1047 | } |
| 1048 | 1048 | } |
| 1049 | + | |
| 1050 | +// uniqueItems should be stripped and moved to description hint (#2123). | |
| 1051 | +func TestCleanJSONSchemaForAntigravity_UniqueItemsStripped(t *testing.T) { | |
| 1052 | + input := `{ | |
| 1053 | + "type": "object", | |
| 1054 | + "properties": { | |
| 1055 | + "ids": { | |
| 1056 | + "type": "array", | |
| 1057 | + "description": "Unique identifiers", | |
| 1058 | + "items": {"type": "string"}, | |
| 1059 | + "uniqueItems": true | |
| 1060 | + } | |
| 1061 | + } | |
| 1062 | + }` | |
| 1063 | + | |
| 1064 | + result := CleanJSONSchemaForAntigravity(input) | |
| 1065 | + | |
| 1066 | + if strings.Contains(result, `"uniqueItems"`) { | |
| 1067 | + t.Errorf("uniqueItems should be removed from schema") | |
| 1068 | + } | |
| 1069 | + if !strings.Contains(result, "uniqueItems: true") { | |
| 1070 | + t.Errorf("uniqueItems hint missing in description") | |
| 1071 | + } | |
| 1072 | +} | |