Jsonnet - The data templating language
This release has a bug fix for std.member
on strings (https://github.com/google/go-jsonnet/issues/656)
std.escapeStringXML
std.sum
std.xor
std.xnor
std.isEmpty
std.round
std.objectKeysValues
(convert an object to a list of pairs)std.objectKeysValuesAll
jsonnet-deps and jsonnet-lint are now included in releases
The previous v0.19.0 release had a small change in the C bindings to allow importbin
to function, but missing from the release notes was mention of the fact that the Python bindings had also changed in a similar way - to require the content of the file to be provided as a bytes
type instead of a str
. To convert from str
to bytes
, simply call .encode()
on the str
.
In order to write Python code that works for both Jsonnet versions, the Jsonnet version is now provided as a field of the _jsonnet module, which allows writing code like the following:
import _jsonnet
import semver
import_returns_bytes = semver.compare(getattr(_jsonnet, 'version', 'v0.18.0')[1:], '0.18.0') > 0
def no_nl_eof(directory, rel):
if import_returns_bytes:
return "foo.jsonnet", b"42"
else:
return "foo.jsonnet", "42"
_jsonnet.evaluate_snippet("test.jsonnet", "{\nlocal foo = import 'foo.jsonnet',\n \n 'bar': foo\n }\n", import_callback=no_nl_eof)
This release also fixes an off-by-one truncation error in the import callback logic of the Python bindings introduced in the previous release. This was only noticeable if the imported file had no trailing \n, or if you were using importbin
with a Python import callback.
In order to support importbin, it was necessary to change the C API for import callbacks so that they can return arbitrary binary blobs (that can contain \0) as opposed to just strings. This change is not binary compatible with previous versions of libjsonnet. If you build against libjsonnet.h and you use import callbacks then you will have to make a small adjustment to your code.
The emscripten build rules are now gone.
Fixed memory leak in libjsonnet++.cpp
Fixed lack of jsonnet_realloc in Go C bindings
There are many more native implementations of library functions on the Go side, resulting in better performance for Jsonnet code calling those library functions.
std.stripChars
std.objectGetOrDefault
and std.objectGetOrDefaultAll
quote_keys
parameter for std.manifestYamlDoc
std.manifestToml
std.manifestJsonMinified
std.parseYaml
<
now works on arrays and performs lexicographic comparison.std.objectValues
and std.objectValuesAll
for getting an array on field values.jsonnet-lint
which automatically finds common problems in Jsonnet programs.jsonnet-deps
which finds all transitive dependencies.std.manifestJsonEx
is now much faster.std.flatMap
(in addition to arrays).EvaluateSnippet*
is now deprecated in favor of EvaluateAnonymousSnippet*
or EvaluateFile*
.go_repository
rule for go-jsonnet.std.rstripChars
std.slice
.tests.sh
script for go-jsonnet no longer refreshes cpp-jsonnet submodule.jsonnetfmt
implementation in Go was added.gojsonnet
using pip. It is a source package, so a reasonably recent Go toolchain is required to install it.<<
and >>
) by negative exponent is a runtime error now.jsonnetfmt -i
no longer modifies timestamps of properly formatted files.jsonnet fmt
is now its own executable called jsonnetfmt
. This helps if you're using the Go version but you still want to have a formatter in your $PATH. Soon we want to have jsonnetfmt be a binary in the Go version too.
If you've got scripts that run jsonnet fmt
, you will need to delete the space from them.
Standard library additions:
There are some performance improvements in the Go version
There are are also plenty of minor bugfixes.
Identical to v0.12.0 except fixed Pypi package manifest