Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean with nativeExt #214

Closed
ant31 opened this issue Jul 8, 2016 · 2 comments
Closed

Boolean with nativeExt #214

ant31 opened this issue Jul 8, 2016 · 2 comments

Comments

@ant31
Copy link

ant31 commented Jul 8, 2016

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
Copy link
Author

ant31 commented Jul 8, 2016

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 added a commit that referenced this issue Jul 8, 2016
Fix #214 bool returned as number, add test
@sparkprime
Copy link
Collaborator

Thanks for the report, it was an easy fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants