-
Notifications
You must be signed in to change notification settings - Fork 2
Fix path wildcards in combination with arrays. #142
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All these enabled test cases 🙌
I have checked that test, it is not wrong the new output seems wrong imo. The comment suggested/asked how to handle asterisk at the end of an wild-card if it does include all variations of the whole path incl. the subfields. Now the behaviour seems weird. input is this:
Fix:
ani* => as expecded would only match with the field my comment asked if the behaviour of fix would be the same as morph. then it would match with "animals", "animal", "animols" and include other values. Now the result includes "animal" and "animals" and transforms them to simple string values and does some strange behaviour from the other tests since it does not provide index numbers in If
|
No, those are two different things:
As for 1., we (well, I) decided against it (see my answer to your comment); Fix path wildcards only ever match a single path segment. The behaviour for 2. is what changed here. Previously, the array ( The pattern copy_field("animals[]", "stringimals[].$append")
copy_field("animal", "stringimals[].$append")
copy_field("animols", "stringimals[].$append") The question then becomes whether each of these cases is implemented correctly (or at all). And |
But also how array and hash are handled is relevant. But this could be a problem of the fix and not of your changes.
operates like I would expect |
Exactly, this is independent of the changes discussed here as it's already working this way. |
my questions are solved. +1 |
Previously, when a wildcard matched multiple fields of which at least one was an array of hashes, `FixPath.findIn()` returned a nested array (e.g., `[[{value=>Mary}, {value=>University}], {value=>Max}]`). Now, matched arrays are flattened (i.e., `[{value=>Mary}, {value=>University}, {value=>Max}]`). See also #142.
Resolves #115 and #119.
NOTE: The updated test
MetafixRecordTest.appendWithAsteriksWildcardAtTheEnd()
was probably wrong in the first place; the original comment expected the other values as well, but the actual review (which was the basis for the unit test) did not.