-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merging default values doesn't work on non associative array. #24
Comments
What would be result if |
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 #13 |
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 :)
The text was updated successfully, but these errors were encountered: