mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 05:39:35 +00:00
Gateway/Dashboard: surface config validation issues (#42664)
Merged via squash.
Prepared head SHA: 43f66cdcf0
Co-authored-by: huntharo <5617868+huntharo@users.noreply.github.com>
Co-authored-by: huntharo <5617868+huntharo@users.noreply.github.com>
Reviewed-by: @huntharo
This commit is contained in:
@@ -72,6 +72,38 @@ describe("gateway config methods", () => {
|
||||
expect(res.payload?.config).toBeTruthy();
|
||||
});
|
||||
|
||||
it("returns config.set validation details in the top-level error message", async () => {
|
||||
const current = await rpcReq<{
|
||||
hash?: string;
|
||||
}>(requireWs(), "config.get", {});
|
||||
expect(current.ok).toBe(true);
|
||||
expect(typeof current.payload?.hash).toBe("string");
|
||||
|
||||
const res = await rpcReq<{
|
||||
ok?: boolean;
|
||||
error?: {
|
||||
message?: string;
|
||||
};
|
||||
}>(requireWs(), "config.set", {
|
||||
raw: JSON.stringify({ gateway: { bind: 123 } }),
|
||||
baseHash: current.payload?.hash,
|
||||
});
|
||||
const error = res.error as
|
||||
| {
|
||||
message?: string;
|
||||
details?: {
|
||||
issues?: Array<{ path?: string; message?: string }>;
|
||||
};
|
||||
}
|
||||
| undefined;
|
||||
|
||||
expect(res.ok).toBe(false);
|
||||
expect(error?.message ?? "").toContain("invalid config:");
|
||||
expect(error?.message ?? "").toContain("gateway.bind");
|
||||
expect(error?.message ?? "").toContain("allowed:");
|
||||
expect(error?.details?.issues?.[0]?.path).toBe("gateway.bind");
|
||||
});
|
||||
|
||||
it("returns a path-scoped config schema lookup", async () => {
|
||||
const res = await rpcReq<{
|
||||
path: string;
|
||||
|
||||
Reference in New Issue
Block a user