Skip to content

Commit 3cb261e

Browse files
authored
fix(project): tighten schema validation (#1944)
1 parent 9cae679 commit 3cb261e

5 files changed

Lines changed: 196 additions & 410 deletions

File tree

src/core/project/schema/gateway.test.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,30 @@ describe("gateway custom validation", () => {
9494
});
9595
expect(result.success).toBe(false);
9696
});
97+
it("rejects unrelated configuration fields on otherwise valid targets", () => {
98+
const apiGateway = {
99+
restApiId: "api",
100+
stage: "prod",
101+
apiGatewayToolConfiguration: { toolFilters: [{ filterPath: "/*", methods: ["GET"] }] },
102+
};
103+
expect(
104+
AgentCoreGatewayTargetSchema.safeParse({
105+
name: "target",
106+
targetType: "apiGateway",
107+
apiGateway,
108+
schemaSource: { inline: { path: "schema.json" } },
109+
}).success,
110+
).toBe(false);
111+
expect(
112+
AgentCoreGatewayTargetSchema.safeParse({
113+
name: "target",
114+
targetType: "lambda",
115+
compute: lambdaCompute,
116+
toolDefinitions: [toolDefinition],
117+
apiGateway,
118+
}).success,
119+
).toBe(false);
120+
});
97121
it("centralizes outbound authentication rules by target type", () => {
98122
const openApi = {
99123
name: "openapi",

0 commit comments

Comments
 (0)