fix: harden legacy plugin schema compatibility tests (#24933) (thanks @pandego)

This commit is contained in:
Peter Steinberger 2026-02-24 03:50:27 +00:00
parent 9f4764cd41
commit 7a42558a3e
2 changed files with 21 additions and 1 deletions

View File

@ -10,6 +10,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- Plugins/Config schema: support legacy plugin schemas without `toJSONSchema()` by falling back to permissive object schema generation. (#24933) Thanks @pandego.
- Cron/Isolated sessions: use full prompt mode for isolated cron runs so skills/extensions are available during cron execution. (#24944)
- Discord/Reasoning: suppress reasoning/thinking-only payload blocks from Discord delivery output. (#24969)
- Sessions/Reasoning: persist `reasoningLevel: "off"` explicitly instead of deleting it so session overrides survive patch/update flows. (#24406, #24559)

View File

@ -1,4 +1,4 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it, vi } from "vitest";
import { z } from "zod";
import { buildChannelConfigSchema } from "./config-schema.js";
@ -14,4 +14,23 @@ describe("buildChannelConfigSchema", () => {
const result = buildChannelConfigSchema(legacySchema);
expect(result.schema).toEqual({ type: "object", additionalProperties: true });
});
it("passes draft-07 compatibility options to toJSONSchema", () => {
const toJSONSchema = vi.fn(() => ({
type: "object",
properties: { enabled: { type: "boolean" } },
}));
const schema = { toJSONSchema } as unknown as Parameters<typeof buildChannelConfigSchema>[0];
const result = buildChannelConfigSchema(schema);
expect(toJSONSchema).toHaveBeenCalledWith({
target: "draft-07",
unrepresentable: "any",
});
expect(result.schema).toEqual({
type: "object",
properties: { enabled: { type: "boolean" } },
});
});
});