Gateway: allow slash-delimited schema lookup paths

This commit is contained in:
Gustavo Madeira Santana
2026-03-06 06:57:04 -05:00
parent 4a80d48ea9
commit fa6c0e1b40
2 changed files with 27 additions and 1 deletions

View File

@@ -143,6 +143,32 @@ describe("config schema", () => {
expect(channelProps?.accessToken).toBeTruthy();
});
it("looks up plugin config paths for slash-delimited plugin ids", () => {
const res = buildConfigSchema({
plugins: [
{
id: "pack/one",
name: "Pack One",
configSchema: {
type: "object",
properties: {
provider: { type: "string" },
},
},
},
],
});
const lookup = lookupConfigSchema(res, "plugins.entries.pack/one.config");
expect(lookup?.path).toBe("plugins.entries.pack/one.config");
expect(lookup?.hintPath).toBe("plugins.entries.pack/one.config");
expect(lookup?.children.find((child) => child.key === "provider")).toMatchObject({
key: "provider",
path: "plugins.entries.pack/one.config.provider",
type: "string",
});
});
it("adds heartbeat target hints with dynamic channels", () => {
const res = buildConfigSchema(heartbeatChannelInput);

View File

@@ -4,7 +4,7 @@ import { NonEmptyString } from "./primitives.js";
const ConfigSchemaLookupPathString = Type.String({
minLength: 1,
maxLength: 1024,
pattern: "^[A-Za-z0-9_.\\[\\]\\-*]+$",
pattern: "^[A-Za-z0-9_./\\[\\]\\-*]+$",
});
export const ConfigGetParamsSchema = Type.Object({}, { additionalProperties: false });