Boolean with nativeExt
Closed this issue · 2 comments
ant31 commented
Booleans returned in native_callback are wrtitten as 1 and 0 instead of the expected true and false values
jsonnet_extensions.py:
def native_bool(b):
return b
json_str = _jsonnet.evaluate_file(
sys.argv[1],
native_callbacks={"nativeBool": (("bool",), native_bool)},
)
testbool.jsonnet:
local nativeBool(b) =
std.native("nativeBool")(b);
{
"true": nativeBool(true),
"false": nativeBool(false),
}
result:
python jsonnet_extensions.py testbool.jsonnet
{
"false": 0,
"true": 1
}
ant31 commented
it is blocker for me. I m using native extensions to load yaml and json string.
How can I help? any workaround I could use ?
sparkprime commented
Thanks for the report, it was an easy fix :)