Response Templating - Miscellaneous Helpers
This article describes some useful helpers that don’t neatly fit into any of the other categories.
Assignment
You can create a string variable of own using the assign
helper, then use it
later in your template e.g.:
Size
The size
helper returns the size of a string, list or map:
With
The with
helper creates a nested scope, allowing you to reference attributes on
an object without fully qualifying it each time.
For instance, given a variable whose value is an object with the properties id
and position
,
with
allows these to be accessed without qualifying each time:
Range
The range
helper emits an array of integers between the bounds specified in the
first and second parameters (both of which are mandatory).
As mentioned above, you can use this with randomInt
and each
to output random length, repeating pieces of content e.g.
Array
The array
helper emits an array containing exactly the values specified as parameters.
Passing no parameters will result in an empty array being returned.