Skip to content

Commit 94e27c8

Browse files
committed
fix(@angular-devkit/schematics-cli): prevent bypassing select/checkbox prompts on validation failure
Previously, when a select or checkbox prompt failed validation, it was bypassed, preventing users from correcting their input. This commit ensures that when validation fails, the prompts are re-displayed, allowing users to make the necessary corrections. This improves the user experience and helps avoid unintended selections. Closes #28189 (cherry picked from commit d4e95f2)
1 parent 05a274a commit 94e27c8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

packages/angular_devkit/schematics_cli/bin/schematics.ts

+7
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,13 @@ function _createPromptProvider(): schema.PromptProvider {
9696
)({
9797
message: definition.message,
9898
default: definition.default,
99+
validate: (values) => {
100+
if (!definition.validator) {
101+
return true;
102+
}
103+
104+
return definition.validator(Object.values(values).map(({ value }) => value));
105+
},
99106
choices: definition.items.map((item) =>
100107
typeof item == 'string'
101108
? {

0 commit comments

Comments
 (0)