Open TobiasNx opened 2 years ago
You marked this as a bug, but I for one am not entirely sure that it is. What is your expectation based on?
okay, @blackwinter you are probably right this is no bug in the sense that Catmandu is behaving similarly: input:
{
"name": "Blacky",
"type" : "bird"
}
{
"name" : "Test",
"test_1" : "test_1"
}
{
"test_1" : "test_1",
"test_2" : "test_2"
}
without additional string:
$ catmandu convert JSON --fix 'paste("combine", "name", "type")' to YAML < input.json
---
combine: Blacky bird
name: Blacky
type: bird
...
---
combine: Test
name: Test
test_1: test_1
...
---
combine: ''
test_1: test_1
test_2: test_2
...
with additional string
$ catmandu convert JSON --fix 'paste("combine", "name", "~is a", "type")' to YAML < input.json
---
combine: Blacky is a bird
name: Blacky
type: bird
...
---
combine: Test is a
name: Test
test_1: test_1
...
---
combine: is a
test_1: test_1
test_2: test_2
...
None the less in my opinion this is not an intuitive behavior. As other functions paste
demands path-references but instead of waiting to process until all paths are met it always creates output.
Let's see what LibreCat/Catmandu#392 yields. Or maybe we could add an option instead of changing the behaviour outright (similar in spirit to Metamorph's flushIncomplete="false"
, see metafacture/metafacture-core#332).
Let's see what LibreCat/Catmandu#392 yields. Or maybe we could add an option instead of changing the behaviour outright (similar in spirit to Metamorph's
flushIncomplete="false"
, see metafacture/metafacture-core#332).
I like the idea to add an option.
See here
I assumed that
paste
only outputs if all elements are provided. But it always pasts when a string is added even when none is provided.Input:
fix:
output:
expected: