Random data generators
This functionality is only available on paid plans. Check our plans here.
We plugged in the entire chancejs API surface in the
$tweak. namespace that enables a myriad of use cases! You can literally pick any method directly from the chancejs API!
This feature is available for:
Variables allow you specify values to reuse across all your rules, without having to repeat that value more than necessary, making your rules cleaner and quicker to modify.
As an example let's look at how to generate a random country and city for a mocked response.
In this particular request, tweak renders the following JSON.
Data generators are a powerful feature to generate random mock data when combined with response hooks.
tweak will respect the data type returned by the data generation function. If a given random data generator returns a numerical value, then tweak will render a numerical value. For example the following JSON:
Will yield the following result: