Skip to content

Releases: google/jsonnet

v0.20.0

17 Apr 19:03
Compare
Choose a tag to compare

Bug fix

This release has a bug fix for std.member on strings (google/go-jsonnet#656)

Standard library additions

  • 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-go specific updates:

jsonnet-deps and jsonnet-lint are now included in releases

v0.19.1

27 Oct 19:50
Compare
Choose a tag to compare

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.

v0.19.0

26 Oct 19:35
Compare
Choose a tag to compare

Language

  • importbin feature for loading binary files

Tooling

  • 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.

Standard library

  • std.all
  • std.any
  • std.split and std.splitLimit support multi-character split strings
  • std.splitLimitR

v0.18.0

21 Dec 18:10
Compare
Choose a tag to compare

WASM

  • The Jsonnet website now uses a WASM build of go-jsonnet for its online demos instead of an emscripten build of the C++ implementation. This is part of the ongoing migration towards go-jsonnet and away from C++ Jsonnet.

Language

  • Unicode characters outside the "basic multilingual plane" (i.e. beyond the first 64k of them) now supported in unicode escapes in string literals that use unicode surrogate pairs.

Tooling

  • Formatter now strips excess newlines after a comment at the end of a file.

Standard library

  • Performance improvement to std.stripChars
  • New: std.objectGetOrDefault and std.objectGetOrDefaultAll
  • New: quote_keys parameter for std.manifestYamlDoc
  • New: std.manifestToml
  • New: std.manifestJsonMinified
  • New: std.parseYaml

v0.17.0

22 Nov 14:21
Compare
Choose a tag to compare

Language

  • Operator < now works on arrays and performs lexicographic comparison.
  • New stdlib functions std.objectValues and std.objectValuesAll for getting an array on field values.
  • Bitshift by negative value is now an error (previously the behavior was inconsistent).

Go implementation

  • New tool available: jsonnet-lint which automatically finds common problems in Jsonnet programs.
  • New tool available: jsonnet-deps which finds all transitive dependencies.
  • Fixed multiple issues with stack traces, which sometimes resulted in missing or confusing stack trace entries.
  • Fixed handling of object locals in object comprehensions.
  • Added missing convenience functions to C and Python bindings. They should be now 100% complete.
  • Python bindings no longer hold GIL during evaluation of Jsonnet code.
  • std.manifestJsonEx is now much faster.
  • Strings are now supported in std.flatMap (in addition to arrays).
  • Improved Go library API: more consitent handling of paths. We no longer treat fake names for ad hoc snippets or extvars as paths. Function family EvaluateSnippet* is now deprecated in favor of EvaluateAnonymousSnippet* or EvaluateFile*.
  • When using bazel, it is possible now to use go_repository rule for go-jsonnet.

C++ implementation

  • Python bindings no longer hold GIL during evaluation of Jsonnet code.

Docs

  • New language reference is available at https://jsonnet.org/ref/language.html.
  • Fixed multiple mistakes in the formal spec.
  • Fixed a mistake in the documentation for std.rstripChars
  • Added documentation for std.slice.

Development and Internals

  • The shared test suite allows specifying an overriding directory for test results (useful for error messages).
  • Added a mechanism to C++ interpreter to call normal Jsonnet functions in the implementation of builtin operations (currently it's used for implementing array comparison).
  • The tests.sh script for go-jsonnet no longer refreshes cpp-jsonnet submodule.
  • Added a separate script for updating cpp-jsonnet, which automatically regenerates stdlib.

v0.16.0

22 May 17:15
Compare
Choose a tag to compare

Language

  • It is now allowed to have positional parameters after named ones

Interpreter (Go)

  • New jsonnetfmt implementation in Go was added.
  • New formatter library in Go was added.
  • It is now possible to install Python package gojsonnet using pip. It is a source package, so a reasonably recent Go toolchain is required to install it.

Interpreter (C++)

  • Shifting (<< and >>) by negative exponent is a runtime error now.
  • Some improvements to error messages.
  • Python bindings now support adding multiple jpathdirs.
  • CMake uses CMAKE_CURRENT_SOURCE_DIR instead of CMAKE_SOURCE_DIR, which makes it easier to include Jsonnet in another project.

v0.15.0

09 Feb 22:29
Compare
Choose a tag to compare

Language

  • New stdlib functions:
    • std.member
    • std.clamp
    • std.stripChars, std.lstripChars, std.stripChars
    • std.flatMap
    • std.repeat

Interpreter (Go)

Runtime

  • Greatly improved performance of multiple stdlib functions:
    • std.reverse
    • std.substr
    • std.base64, std.base64Decode, std.base64DecodeBytes
  • Adaptive string representation - naively joining many short
    strings using operator + is now a linear operation.
  • Fixed incorrect handling of overflow in bitwise operators.
  • Tests should now pass on x86 and ARM.
  • Unary + no longer allowed on objects.

API

  • Fully compatible, experimental Python API is now available.
  • Import cache is now preserved across evaluations, which
    improves performance when evaluating multiple files, which
    use the same libraries or when evaluating the same file with
    different TLAVars. Note that changing ExtVars still clears
    the cache, because they potentially affect every import.
  • New public functions jsonnet.ResolveImport and
    jsonnet.ImportData for easier integration of tooling
    with importers.
  • New public function toolutils.Children for easier traversing
    of AST.
  • AST contains comments now, which allow building code transformation
    tooling.

Interpreter (C++)

  • Fixed incorrect error message, when too few arguments are provided
    for string formatting.
  • Fixed a dangling pointer, which could have potentially caused crashes.

v0.14.0

16 Sep 14:28
Compare
Choose a tag to compare

Interpreter (Go)

  • Object field caching - now each field is evaluated only once for each object. This may drastically improve performance in many cases.
  • Fixed crash during preprocessing of some array comprehensions (google/go-jsonnet#291).
  • Building and testing with Bazel is now supported.
  • Much faster (builtin) implementation of std.sort.
  • Removed some public APIs which should have been internal in the first place. If it broke your code, please open an issue.

Interpreter (C++)

  • Added support for top level arguments (TLAs) to C++ bindings.

jsonnetfmt

  • jsonnetfmt -i no longer modifies timestamps of properly formatted files.

Misc

  • Added missing SONAME to shared libraries.
  • It is now possible to use system libraries instead of bundled ones.
  • Multiple CMake improvements.

v0.13.0

03 Jun 17:59
Compare
Choose a tag to compare

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:

  • std.reverse
  • std.encodeUTF8 and std.decodeUTF8

There are some performance improvements in the Go version

There are are also plenty of minor bugfixes.

v0.12.1

19 Dec 10:32
Compare
Choose a tag to compare

Identical to v0.12.0 except fixed Pypi package manifest