Issue #3480180 by alexpott: Recipe validation error in 10.4.x

merge-requests/9809/head
Dave Long 2024-10-15 10:42:12 +01:00
parent dc4a5f9e0a
commit dee8d88336
No known key found for this signature in database
GPG Key ID: ED52AE211E142771
2 changed files with 16 additions and 21 deletions

View File

@ -180,7 +180,7 @@ final class Recipe {
]),
]),
'input' => new Optional([
new Type('associative_array'),
new Type('array'),
new All([
new Collection(
fields: [
@ -192,7 +192,7 @@ final class Recipe {
// There can be an optional set of constraints, which is an
// associative array of arrays, as in config schema.
'constraints' => new Optional([
new Type('associative_array'),
new Type('array'),
]),
'data_type' => [
// The data type must be known to the typed data system.
@ -211,7 +211,7 @@ final class Recipe {
new Choice(['ask', 'askHidden', 'confirm', 'choice']),
],
'arguments' => new Optional([
new Type('associative_array'),
new Type('array'),
]),
]),
]),
@ -224,7 +224,7 @@ final class Recipe {
'value' => new Optional(),
'config' => new Optional([
new Sequentially([
new Type('list'),
new Type('array'),
new Count(2),
new All([
new Type('string'),

View File

@ -351,15 +351,13 @@ YAML,
yield 'input definitions are an indexed array' => [
<<<YAML
name: Bad input definitions
input:
- data_type: string
description: A valid enough input, but in an indexed array.
default:
source: value
value: Here be dragons
input: false
YAML,
[
'[input]' => ['This value should be of type associative_array.'],
'[input]' => [
'This value should be of type array.',
'This value should be of type iterable.',
],
],
];
yield 'input data type is missing' => [
@ -413,14 +411,13 @@ input:
foo:
data_type: string
description: 'Constraints need to be associative'
constraints:
- Type: string
constraints: false
default:
source: value
value: Here be dragons
YAML,
[
'[input][foo][constraints]' => ['This value should be of type associative_array.'],
'[input][foo][constraints]' => ['This value should be of type array.'],
],
];
yield 'input data type is unknown' => [
@ -499,13 +496,13 @@ input:
description: 'Prompt arguments must be associative'
prompt:
method: ask
arguments: [1, 2]
arguments: false
default:
source: value
value: Here be dragons
YAML,
[
'[input][foo][prompt][arguments]' => ['This value should be of type associative_array.'],
'[input][foo][prompt][arguments]' => ['This value should be of type array.'],
],
];
yield 'input definition without default value' => [
@ -552,7 +549,7 @@ input:
config: 'system.site:mail'
YAML,
[
'[input][foo][default][config]' => ['This value should be of type list.'],
'[input][foo][default][config]' => ['This value should be of type array.'],
],
];
yield 'default value from config has too few values' => [
@ -583,12 +580,10 @@ input:
method: ask
default:
source: config
config:
name: system.site
key: mail
config: false
YAML,
[
'[input][foo][default][config]' => ['This value should be of type list.'],
'[input][foo][default][config]' => ['This value should be of type array.'],
],
];
yield 'default value from config has non-string values' => [