From 2934e369441820d9770d6ef181aa017c4cbb77db Mon Sep 17 00:00:00 2001 From: eric sciple Date: Mon, 8 Dec 2025 09:25:51 -0600 Subject: [PATCH] Allow empty strings in workflow_dispatch choice options (#245) Fixes vscode#395 - Empty value for choice option shows 'Unexpected value' error Empty strings are valid options for workflow_dispatch inputs with type: choice. They allow users to make a choice 'optional' or force explicit selection. Changes: - Add sequence-of-string type that allows empty strings (unlike sequence-of-non-empty-string) - Use sequence-of-string for workflow_dispatch options field - Add test to verify empty string in choice options doesn't produce validation errors --- languageservice/src/validate.test.ts | 27 ++++++++++++++++++++++++++ workflow-parser/src/workflow-v1.0.json | 7 ++++++- 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/languageservice/src/validate.test.ts b/languageservice/src/validate.test.ts index 367c39e..8e5865c 100644 --- a/languageservice/src/validate.test.ts +++ b/languageservice/src/validate.test.ts @@ -385,4 +385,31 @@ jobs: expect(result).toEqual([]); }); }); + + describe("workflow_dispatch", () => { + it("allows empty string in choice options", async () => { + const result = await validate( + createDocument( + "wf.yaml", + `on: + workflow_dispatch: + inputs: + plugin-name: + description: Specific plugin to build + type: choice + options: + - '' + - foo + - bar +jobs: + build: + runs-on: ubuntu-latest + steps: + - run: echo` + ) + ); + + expect(result).toEqual([]); + }); + }); }); diff --git a/workflow-parser/src/workflow-v1.0.json b/workflow-parser/src/workflow-v1.0.json index ba3d154..4d09751 100644 --- a/workflow-parser/src/workflow-v1.0.json +++ b/workflow-parser/src/workflow-v1.0.json @@ -1539,7 +1539,7 @@ }, "default": "workflow-dispatch-input-default", "options": { - "type": "sequence-of-non-empty-string", + "type": "sequence-of-string", "description": "The options of the dropdown list, if the type is a choice." } } @@ -2419,6 +2419,11 @@ "item-type": "non-empty-string" } }, + "sequence-of-string": { + "sequence": { + "item-type": "string" + } + }, "boolean-needs-context": { "context": [ "github",