There are situations where empty composite value can come in handy. For example:
data: user: firstName: random("John","Adam", "Peter") lastName: random("Doe", "Jackson", "Smith") fields: {} output: json($data)
Generated JSON could look like:
{ "user": { "firstName": "Peter", "lastName": "Smith" }, "fields": {} }
In this case, we want to have fields object, just we want it to be empty.
Technical approach:
This can be easily achieved by removing values.isEmpty() check from
CompositeValue at line if (values == null || values.isEmpty()) {
There are situations where empty composite value can come in handy. For example:
data: user: firstName: random("John","Adam", "Peter") lastName: random("Doe", "Jackson", "Smith") fields: {} output: json($data)
Generated JSON could look like:{ "user": { "firstName": "Peter", "lastName": "Smith" }, "fields": {} }
In this case, we want to have fields object, just we want it to be empty.Technical approach:
This can be easily achieved by removing
values.isEmpty()
check from CompositeValue at lineif (values == null || values.isEmpty()) {