Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Tests: Gemini schemas inline local refs before arrays get their items

milind-soni992f347b990c
diff --git a/server/tool-schema-profile.test.ts b/server/tool-schema-profile.test.ts
index 5c9c18d959..dccb80f0a1 100644
--- a/server/tool-schema-profile.test.ts
+++ b/server/tool-schema-profile.test.ts
@@ -217,10 +217,11 @@ describe("fitting one tool schema to Gemini's per-tool limit", () => {
const fit = fitToolSchema(schema, GEMINI);
expect(fit.outcome).toBe("kept");
if (fit.outcome !== "kept") return;
- expect(fit.schema).toEqual({ type: "object", $defs: { tags: { type: "array", items: { type: "string" } } }, properties: {
+ // Local refs are inlined for Gemini first, so the referenced array gets its items in place.
+ expect(fit.schema).toEqual({ type: "object", properties: {
attendees: { type: "array", description: "Email addresses", items: { type: "string" } },
include: { type: ["array", "null"], items: { type: "string" } },
- ids: { type: "array", items: { type: "integer" } }, tags: { $ref: "#/$defs/tags" },
+ ids: { type: "array", items: { type: "integer" } }, tags: { type: "array", items: { type: "string" } },
group: { type: "object", properties: { domains: { type: "array", items: { type: "string" } } } },
} });
expect(schema).toEqual(original);
@@ -230,7 +231,7 @@ describe("fitting one tool schema to Gemini's per-tool limit", () => {
const schema = { type: "object", properties: { ids: { type: "array", items: { type: "integer" } }, name: { type: "string" } } };
const fit = fitToolSchema(schema, GEMINI);
expect(fit.outcome).toBe("kept");
- if (fit.outcome === "kept") expect(fit.schema).toBe(schema);
+ if (fit.outcome === "kept") expect(fit.schema).toEqual(schema);
});
it("keeps an integer array's items when a nested field is collapsed", () => {