metafacture / metafacture-fix

Work in progress towards an implementation of the Fix language for Metafacture
Apache License 2.0
6 stars 2 forks source link

`remove_field` from array of objects does not work. #193

Open TobiasNx opened 2 years ago

TobiasNx commented 2 years ago
remove_field("arrayOfObject_1[].*.arrayOfObject_2[]")

or

remove_field("animals[].*.type")

Will add integration tests

TobiasNx commented 1 year ago

It also does not work with $last: https://metafacture.org/playground/?flux=PG_DATA%0A%7Cas-records%0A%7Cdecode-json%0A%7Cfix%0A%7Cencode-json%28prettyPrinting%3D%22true%22%29%0A%7Cprint%0A%3B%0A&fix=add_field%28%22author%5B%5D.%24last.test%22%2C%22test%22%29%0A%0Aremove_field%28%22author%5B%5D.%24last.test%22%29&data=%7B%0A++%22author%22%3A+%5B%0A++++%7B%0A++++++%22name%22%3A+%22RUVIVAL+Team%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%2C%0A++++%7B%0A++++++%22name%22%3A+%22Samuel+Duval%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%2C%0A++++%7B%0A++++++%22name%22%3A+%22Berenice+Lopez+Mendez%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%2C%0A++++%7B%0A++++++%22name%22%3A+%22Lukas+Schreiner%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%2C%0A++++%7B%0A++++++%22name%22%3A+%22Isidora+Vrbavac%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%0A++%5D%0A%7D%0A%7B%0A++%22author%22%3A+%5B%0A++++%7B%0A++++++%22@type%22%3A+%22Person%22%2C%0A++++++%22name%22%3A+%22J%C3%BCrgen+B%C3%B6hner%22%0A++++%7D%0A++%5D%0A%7D%0A&active-editor=fix

TobiasNx commented 1 year ago

It empties the array when used with *: https://metafacture.org/playground/?flux=PG_DATA%0A%7Cas-records%0A%7Cdecode-json%0A%7Cfix%0A%7Cencode-json%28prettyPrinting%3D%22true%22%29%0A%7Cprint%0A%3B%0A&fix=add_field%28%22author%5B%5D.%24last.test%22%2C%22test%22%29%0A%0Aremove_field%28%22author%5B%5D.%2A.test%22%29&data=%7B%0A++%22author%22%3A+%5B%0A++++%7B%0A++++++%22name%22%3A+%22RUVIVAL+Team%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%2C%0A++++%7B%0A++++++%22name%22%3A+%22Samuel+Duval%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%2C%0A++++%7B%0A++++++%22name%22%3A+%22Berenice+Lopez+Mendez%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%2C%0A++++%7B%0A++++++%22name%22%3A+%22Lukas+Schreiner%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%2C%0A++++%7B%0A++++++%22name%22%3A+%22Isidora+Vrbavac%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%0A++%5D%0A%7D%0A%7B%0A++%22author%22%3A+%5B%0A++++%7B%0A++++++%22@type%22%3A+%22Person%22%2C%0A++++++%22name%22%3A+%22J%C3%BCrgen+B%C3%B6hner%22%0A++++%7D%0A++%5D%0A%7D%0A&active-editor=fix

blackwinter commented 1 year ago

Also affects move_field() (see #185) and copy_field() (as of #313).

blackwinter commented 11 months ago

Integration tests:

TobiasNx commented 3 months ago

This also does not work with $last.

https://metafacture.org/playground/?flux=inputFile%0A%7Copen-file%0A%7Cas-records%0A%7Cdecode-json%0A%7Cfix%28transformationFile%29%0A%7Cencode-yaml%0A%7Cprint%0A%3B&transformation=move_field%28%22author%5B%5D%22%2C%22very.nested.author%22%29%0Aremove_field%28%22very.nested.author.%24last.@type%22%29&data=%7B%0A++%22author%22%3A+%5B%0A++++%7B%0A++++++%22name%22%3A+%22Test+Team%22%2C%0A++++++%22@type%22%3A+%22Organization%22%0A++++%7D%2C%0A++++%7B%0A++++++%22name%22%3A+%22Maxi+Muster%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%2C%0A++++%7B%0A++++++%22name%22%3A+%22Sally+Sample%22%2C%0A++++++%22@type%22%3A+%22Person%22%0A++++%7D%0A++%5D%0A%7D%0A%7B%0A++%22author%22%3A+%5B%0A++++%7B%0A++++++%22@type%22%3A+%22Person%22%2C%0A++++++%22name%22%3A+%22J%C3%BCrgen+Meta%22%0A++++%7D%0A++%5D%0A%7D%0A