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
This commit is contained in:
@@ -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([]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user