Releases: mandelsoft/spiff
Dynamic References
The main feature of this release is a better support of dynamic references. So far dynamic reference expressions could only indirectly be implemented using the eval
function using a composed string containing the final static reference expression. With this release a direct expression syntax is supported.
The following new features will be usable with this release
- dynamic reference expressions
- simple dynamic reference components:
foo.[name].bar
Besides a number as index as before, now any expression could be used as index. Its value is used to
address list elements as well as map fields. - dynamic multi component indices:
foo.[list].bar
If the index expression of an indexed reference expression evaluates to a list, the entries of the list are used as
path components. - slice indices:
foo.[1..3]
if the index of an indexed reference expression evaluates to an index range, the reference expression
evaluates to a slice of the basic array
- simple dynamic reference components:
- new functions
ipset
provides a document structure independent way to determine ip sets based on dedicated
preconfigured entries of a set of ip ranges. It can replace the functionality ofstatic_ips
in non-bosh-manifest
documentsstub
directly refers to elements in merge stubs.element
can be used to address elements in lists or maps.compact
deletes empty entries in a list
- Subtraction of IP addresses and IP constants in dynaml expressions
- New marker
&local
to indicate nodes to be deleted after processing a stub
Additionally some tricky bugs in the merge logic are fixed.
Maps and strings
Added some new string based functions:
replace
replace stub stringscontains
extended to check also for sub strings in addition to list entriesindex
find first occurence of substringlastindex
find last occurence
To support better creation of dynamic maps and map entries within user defined functions and mapping expressions
the function makemap
has been added and dynaml syntax has been extended to support map literals. Map literals
allow to desribe both, keys and values with dynaml expressions.
e.g.:
k: name
a: age
age: 25
map: (( { k="alice", a=age } ))
provides a map
map:
name: alice
age: 25
Additionally the new boolean function valid
can be used to check for defined expressions evaluating to non-null values.
Besides new functionality, some problems are fixed:
- lists containing merge entries were merged as index lists even if the entries contain key fields.
- lists containing expressions as value of key fields were not merged correctly. Now it is possible to
use simple expressions here. There might still be combinations preventing the correct key evaluation prior to
merging.
The world of undefined values.
The major feature of this release is to introduce a new literal for an undefined value (~~
). It opens a rich set of possibilities for dealing with implicit and explicit configuration settings managed by different stubs.
Additionally, to round up this feature, a new function require
has been added, that simplifies the handling of null
values.
Ranges for `static_ips`
The builtin function static_ips
now additionally accepts (deep) list arguments with integers as leafs.
This allows specifying ranges for large numbers of IPs instead of explicitly enumerating them.
for example:
static_ips([1..10])
Templates and Friends
Feature release focusing on the completion of the template functionality:
- template marker now supported for lists to define list templates
- template marker also available for single values
- fix handling of merges described in templates
- temporary marker to indicate intermediate helper nodes, which will be omited in final output
- improved error reporting by distinguishing subsequent errors from root errors
- using spiff in pipelines
- regular expression matches
- functions
uniq
andcontains
- transforming lists to maps to support generation of maps with arbitrary keys
- aggregation support looping over lists and maps to aggregate entries to a single result
- various fixes
Complete documentation can be found here
First fork release for spiff introducing spiff++
This release adds some new core functionality to spiff, templates and lambda expressions. Please have a look at the documentation.