Closed ncou closed 3 years ago
What would be result if $data = ['paths' => ['path_1', 'path_1', 'path_1']];
?
Multiple identical values in dataset are not necessarily an error.
yes you got a point, but if there is already 'path_1' in the user value, why add the default value (which is the same). I don't think a unique function should be applyed, i only think it's not really logical to add again the default value while it's already present in the data array.
I think my issue is the same than the ticket https://github.com/nette/schema/issues/13 If it's a duplicate, i will close my ticket.
Yes, it is duplicate issue.
Hi,
I encounter a bug with the merge function when the schema use a list of string. Here is an example :
` $schema = Expect::structure([ 'paths' => Expect::arrayOf('string')->default(['path_1']), ]);
$data = ['paths' => ['path_1']]; ` after the processSchema() i got the following result :
['path_1', 'path_1']
but i expect the values to be merged, and only have['path_1']
as a result. This wrong behavior is when the array has numeric keys. If a use an associative array (ex : ['default' => 'path_1']) the merge work fine and i got only on element for the result.Keep up the good work, this library is amazing :)