Closed Shishqa closed 1 year ago
So, parse
is different from compile
and is meant more for debugging. Is there a specific use case for you?
Sorry for the belated reply!
I expect []
in $map
as I have provided a default value {}
. It is confusing to see null
in both cases: when the value is undefined and when I explicitly define it with an empty map. And parse
(in yaml) provides a correct output for me, but compile
doesn't.
Maybe I miss something regarding the design of the API, and null
should be always considered an empty collection?
OK, I see now -- I would indeed consider this a bug in compile
. There should be a consistent zero value according to the type.
I did some testing, I think the issue is that you are not coercing the values. If you run with -c
you will get consistent results. (This is still a bug, I think specifically with inputs
)
Fixed, but note that maps appear in Clout as lists of entries, not maps. But now you will get an empty list instead of null.
Consider a small template:
Let's parse it and dump to yaml:
Let's compile it and dump:
Let's parse and dump to json:
Expected
I expect that
$map
is equal to an empty list[]
, as I have provided a default value{}
.