-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
fix: defaults in ordered array are not filled #2548
fix: defaults in ordered array are not filled #2548
Conversation
i've read the contributing rules, i decided to go further fixing it, as i found it already marked as a bug, and it's such a great feature to be fixed. i hope it helps, and i hope i'm not violating the rules. |
@iifawzi This doesn't work with refs. |
Not sure how others would like it, but I'd do something like the |
@iifawzi
[1, 2]; // OK
[1, undefined, 2]; // OK (although empty slots are more preferable than undefineds, if an item is undefined just increase the insert pointer i)
[1, undefined, 2, undefined]; // Not OK -> [1, undefined, 2] instead
[undefined, 1, 2] // OK The best way to implement this, as I said, would be to loop the schemas reversely, and discard any undefineds before an actual value is encountered.
Also cc @hueniverse for validation and approval. |
Great, this's clear now. I will commit the changes tomorrow night, as it's 3 AM here (GMT+2), thanks @brianle1301 for your valuable time, and for summing this up. |
2193d16
to
36f24d2
Compare
Hi, @brianle1301, i've made all mentioned points, added more tests, it seems much better now, dynamic schemas are resolved, a separate loop is used. i hope we're covering all cases now, waiting for your review. @hueniverse, When you got a time to check, Is it looks good? awaiting for your review. |
@iifawzi Can you please mark all the previous reviews as resolved? Just to clean things up a bit |
Fixes #2404
This will ensure that, if any remaining ordered contains a default constraint, it will be pushed to the value array.
also, i changed the name of
fillOrderedErrors
method tocheckRemainingOrdereds
for clarity, since it's now not only filling errors.