From 5e59eeea3f66b7713a23f4d1bdde31b64c236dbd Mon Sep 17 00:00:00 2001 From: Tianqi Zhang Date: Fri, 26 Dec 2025 09:20:26 +0800 Subject: [PATCH] Fix settings validation to properly respect additionalProperties: false --- packages/cli/src/config/settings-validation.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/cli/src/config/settings-validation.ts b/packages/cli/src/config/settings-validation.ts index da06cf082e..9cc8763d44 100644 --- a/packages/cli/src/config/settings-validation.ts +++ b/packages/cli/src/config/settings-validation.ts @@ -54,9 +54,10 @@ function buildZodSchemaFromJsonSchema(def: any): z.ZodTypeAny { } shape[key] = propSchema; } - schema = z.object(shape).passthrough(); + // Don't apply passthrough() here - we'll determine the behavior below + schema = z.object(shape); } else { - schema = z.object({}).passthrough(); + schema = z.object({}); } if (def.additionalProperties === false) { @@ -65,6 +66,9 @@ function buildZodSchemaFromJsonSchema(def: any): z.ZodTypeAny { schema = schema.catchall( buildZodSchemaFromJsonSchema(def.additionalProperties), ); + } else { + // Default to passthrough when additionalProperties is not explicitly false + schema = schema.passthrough(); } return schema;