fix: drop null-only union variants (#782) (thanks @AbhisekBasu1)

Co-authored-by: Abhi <AbhisekBasu1@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-01-13 01:58:30 +00:00
parent ba1d80bd00
commit a27efd57bd
5 changed files with 315 additions and 435 deletions

View File

@@ -103,7 +103,7 @@ describe("createClawdbotCodingTools", () => {
});
});
it("flattens simple anyOf/oneOf unions into single types", () => {
it("drops null-only union variants without flattening other unions", () => {
const cleaned = __testing.cleanToolSchemaForGemini({
type: "object",
properties: {
@@ -125,8 +125,7 @@ describe("createClawdbotCodingTools", () => {
| { type?: unknown; anyOf?: unknown; oneOf?: unknown }
| undefined;
expect(count?.anyOf).toBeUndefined();
expect(count?.oneOf).toBeUndefined();
expect(count?.type).toBe("string");
expect(Array.isArray(count?.oneOf)).toBe(true);
});
it("preserves action enums in normalized schemas", () => {