From 9a5669b6d417031419e05de5aea86d60e4a19465 Mon Sep 17 00:00:00 2001 From: chinesepowered Date: Tue, 7 Apr 2026 08:52:51 -0700 Subject: [PATCH] fix(scripts): avoid 'undefined Options: ...' for enums without description schema.description is only assigned when setting.description is truthy. For enum settings missing a description, the subsequent += produced the literal string 'undefined Options: foo, bar' in the generated JSON schema. Initialize the field when absent instead of concatenating onto undefined. --- scripts/generate-settings-schema.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/generate-settings-schema.ts b/scripts/generate-settings-schema.ts index 9031312195..a8b8f732bd 100644 --- a/scripts/generate-settings-schema.ts +++ b/scripts/generate-settings-schema.ts @@ -121,8 +121,11 @@ function convertSettingToJsonSchema( case 'enum': if (setting.options && setting.options.length > 0) { schema.enum = setting.options.map((o) => o.value); - schema.description += - ' Options: ' + setting.options.map((o) => `${o.value}`).join(', '); + const optionsText = + 'Options: ' + setting.options.map((o) => `${o.value}`).join(', '); + schema.description = schema.description + ? `${schema.description} ${optionsText}` + : optionsText; } else { // Enum without predefined options - accept any string schema.type = 'string';