Gateway: allow slash-delimited schema lookup paths
This commit is contained in:
@@ -143,6 +143,32 @@ describe("config schema", () => {
|
|||||||
expect(channelProps?.accessToken).toBeTruthy();
|
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", () => {
|
it("adds heartbeat target hints with dynamic channels", () => {
|
||||||
const res = buildConfigSchema(heartbeatChannelInput);
|
const res = buildConfigSchema(heartbeatChannelInput);
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { NonEmptyString } from "./primitives.js";
|
|||||||
const ConfigSchemaLookupPathString = Type.String({
|
const ConfigSchemaLookupPathString = Type.String({
|
||||||
minLength: 1,
|
minLength: 1,
|
||||||
maxLength: 1024,
|
maxLength: 1024,
|
||||||
pattern: "^[A-Za-z0-9_.\\[\\]\\-*]+$",
|
pattern: "^[A-Za-z0-9_./\\[\\]\\-*]+$",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const ConfigGetParamsSchema = Type.Object({}, { additionalProperties: false });
|
export const ConfigGetParamsSchema = Type.Object({}, { additionalProperties: false });
|
||||||
|
|||||||
Reference in New Issue
Block a user