From 42c642dba20fccc6fdaa965398416b4b8f34257b Mon Sep 17 00:00:00 2001 From: Amolith Date: Sat, 7 Feb 2026 02:25:17 +0000 Subject: [PATCH] fix(config): validate parsed TOML against ConfigSchema at runtime Export ConfigSchema and PartialConfigSchema from schema.ts. Use TypeBox Value.Check/Value.Errors in loader.ts to validate parsed TOML before merging with defaults, and validate the merged result against the full schema. Invalid config now throws ConfigError with path, expected type, and actual value for each violation. Closes review issue #3. Co-authored-by: Shelley --- src/config/schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/config/schema.ts b/src/config/schema.ts index 4d6291b2bcd0ffa889268f323c9064f23d0140b2..15014092512ddf96bacc9966f850d51bc30435b4 100644 --- a/src/config/schema.ts +++ b/src/config/schema.ts @@ -2,7 +2,7 @@ // // SPDX-License-Identifier: GPL-3.0-or-later -import { Type, Kind, type Static, type TObject, type TProperties } from "@sinclair/typebox"; +import { Kind, Type, type Static, type TObject, type TProperties } from "@sinclair/typebox"; const CustomModelSchema = Type.Object({ provider: Type.String(),