Schemas do not accept default value
DaazKu opened this issue · 0 comments
DaazKu commented
This does not work:
$schema = Schema::parse([
'letter' => Schema::parse([
'description' => 'A letter',
'default' => 'a',
'items' => [
'enum' => ['a', 'b', 'c'],
'type' => 'string'
],
'style' => 'form',
'type' => 'string',
])
]);
$data = [];
$data = $schema->validate($data);
// $data should be ['letter' => 'a']
This does:
$schema = Schema::parse([
'letter' => [
'description' => 'A letter',
'default' => 'a',
'items' => [
'enum' => ['a', 'b', 'c'],
'type' => 'string'
],
'style' => 'form',
'type' => 'string',
]
]);
$data = [];
$data = $schema->validate($data);
// $data should be ['letter' => 'a']