Skip to content

v0.5.0-pre1-test

Pre-release
Pre-release
Compare
Choose a tag to compare
@github-actions github-actions released this 23 Apr 16:06
· 434 commits to master since this release

Ported new jsonnet standard library methods

std.get, std.manifestJsonMinified, others

importbin statement

Allows to import binary files as byte arrays
importbin 'some.bin' == [1, 2, 3, 4]

Object field order preservation

This feature was requested multiple times, both in this repo, and in other jsonnet implementations:
#76 #52
google/jsonnet#407
google/jsonnet#903
google/go-jsonnet#222

This feature is even implemented in scala jsonnet implementation, but doing this in same way will break backwards compatibility (Scala implementation has global flag for doing so)
databricks/sjsonnet#53

Implementation in jrsonnet is opt-in, both at compile level (this feature is not built by default, as it is experimental, it is built in this prerelease though), and runtime level:

To configure CLI manifestification for this feature, you should pass --exp-preserve-order flag:

jrsonnet --exp-preserve-order -e '{a: 1, b: 2, c: 3} + { d: 4, e: 5, a: 6 }'

For language usage there is optional argument added to manifestification functions:

std.manifestJsonEx({a: 1, b: 2, c: 3} + { d: 4, e: 5, a: 6 }, '   ', preserve_order = true)

And there is also new arguments on Rust api side to some functions

Both code snippets will yield

{ "b": 2, "c": 3, "d": 4, "e": 5, "a": 6 }

a is last, because it was overriden later

Rust API improvements

Tons of interop api was implemented, i.e fancier builtin building stuff (this is already used for standard built-ins)
https://github.com/CertainLach/jrsonnet/blob/gcmodule/crates/jrsonnet-evaluator/src/builtin/mod.rs

And automatic generators for Rust<->Jsonnet structure translation
https://github.com/CertainLach/jrsonnet/blob/gcmodule/crates/jrsonnet-evaluator/tests/typed_obj.rs

Full Changelog: v0.5.0-gcmodule-test...v0.5.0-pre1-test