summaryrefslogtreecommitdiffhomepage
path: root/packages
diff options
context:
space:
mode:
authorTimo Clasen <[email protected]>2025-09-18 13:30:44 +0200
committerGitHub <[email protected]>2025-09-18 06:30:44 -0500
commit0df6fc1226d521a1aa1fe11458fcb350de7bc7dd (patch)
treeb8de4f72ec73072f15b945e9dfb47d724dff202a /packages
parent32ba2e02aa1ab12143c759ed940df2da39124488 (diff)
downloadopencode-0df6fc1226d521a1aa1fe11458fcb350de7bc7dd.tar.gz
opencode-0df6fc1226d521a1aa1fe11458fcb350de7bc7dd.zip
fix(config): keybinds should not be required in config schema (#2669)
Diffstat (limited to 'packages')
-rwxr-xr-xpackages/opencode/script/schema.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/packages/opencode/script/schema.ts b/packages/opencode/script/schema.ts
index 7e450df92..9721b557a 100755
--- a/packages/opencode/script/schema.ts
+++ b/packages/opencode/script/schema.ts
@@ -7,6 +7,7 @@ const file = process.argv[2]
console.log(file)
const result = z.toJSONSchema(Config.Info, {
+ io: "input", // Generate input shape (treats optional().default() as not required)
/**
* We'll use the `default` values of the field as the only value in `examples`.
* This will ensure no docs are needed to be read, as the configuration is
@@ -14,8 +15,15 @@ const result = z.toJSONSchema(Config.Info, {
*
* See https://json-schema.org/draft/2020-12/draft-bhutton-json-schema-validation-00#rfc.section.9.5
*/
- override(input) {
- const schema = input.jsonSchema
+ override(ctx) {
+ const schema = ctx.jsonSchema
+
+ // Preserve strictness: set additionalProperties: false for objects
+ if (schema && typeof schema === "object" && schema.type === "object" && schema.additionalProperties === undefined) {
+ schema.additionalProperties = false
+ }
+
+ // Add examples and default descriptions for string fields with defaults
if (schema && typeof schema === "object" && "type" in schema && schema.type === "string" && schema?.default) {
if (!schema.examples) {
schema.examples = [schema.default]