fix: defaults in ordered array are not filled#2548
fix: defaults in ordered array are not filled#2548hueniverse merged 10 commits intohapijs:masterfrom
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] // OKThe 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
fillOrderedErrorsmethod tocheckRemainingOrderedsfor clarity, since it's now not only filling errors.