Bloomer mock provides advanced features to generate data in highly controlled way. For most use-cases simple data generation is sufficient, but for complex data generation advanced features are required.
Few advance features that bloomer mock provides are -
-
Null and Empty Fields
-
Custom attribute values
-
Javascript generation
Null and Empty Fields
With Null and Empty percentage parameters you can control number of values to be empty or null for selected attribute.
Null - null
are placed for percentage defined in attribute
Empty - Attributes with percentage defined will have empty values
-
Click on more icon for selected attribute
-
In null and empty text let’s define null percentage - 10% and empty percentage - 20%

-
In preview 10 records are shown.
Out of 10, 1 record will have null value and 2 records will have empty value.
[
{},
{
"age": 2
},
{},
{
"age": 4
},
{
"age": 5
},
{
"age": null
},
{
"age": 7
},
{
"age": 8
},
{
"age": 9
},
{
"age": 10
}
]
In above preview we can see 1 null value and 2 empty values for age attribute.
Custom Attribute Values
User can provide custom list of values for an attribute. Depend on data type different control is given to user. Custom attribute section can be opened by clicking more icon associated with each attribute.
Custom Values - String data type
For string data type user can provide custom list of values.
To add values to custom list type values in Override Attributes
text box.
city
attribute user can provide list of
cities.
-
Click on more icon for the selected attribute
-
Provide custom values in Override Attributes text box
-
Click on Save
-
Preview pane should show the preview that has custom values

Tip
|
Values from Generate AI can be used to populate custom list. |
city
attribute add list of cities
generated
by Gen AI
-
Click on value selection textbox for the selected attribute
-
Click on robot icon in the top search bar
-
In search bar type
cities in India
-
Click on
Select
to select generated values -
Above generated values are added to override values section
-
To go to override values click on more icon
-
In
Override Attributes
section add or remove any values from generated list -
Click on Save

cities in india

Custom Values - Number data type
For number data type one can define minimum value, maximum value and number of decimal digits.
Minimum value should be always less than maximum value, otherwise validation will fail. In case just minimum value is provided then maximum is set to +infinity and similarly if only maximum value is provided then minimum is set to -infinity.
age
attribute user can provide range of
values.
-
Click on more icon for the selected attribute
-
In custom values section provide minimum value - 10, maximum value - 20 and decimal digits - 3

age
attribute-
Click on
Save
-
Preview pane should show the preview for age attribute value between 10 - 20.
[
{
"name": "Diego Rivera",
"age": 10.327
},
{
"name": "Klimt",
"age": 11.337
},
{
"name": "Diego Rivera",
"age": 17.576
},
{
"name": "Botticelli",
"age": 10.077
},
{
"name": "Vettriano",
"age": 11.652
},
{
"name": "Diego Rivera",
"age": 10.025
},
{
"name": "Durer",
"age": 19.844
},
{
"name": "Paul Klee",
"age": 17.408
},
{
"name": "Titian",
"age": 16.702
},
{
"name": "Rembrandt",
"age": 19.535
}
]
Javascript Generation
Out of all javascript generation is the most advanced feature provided by bloomer mock.
Javascript generation allow user to give most flexibility in terms of defining the
attribute value.
In javascript generation feature user can use any javascript native functions to define
and modify the attribute value.
With javascript user can perform advanced operations like string manipulation, date
manipulation, number manipulation etc.
Tip
|
Use case such as performing UpperCase, LowerCase, Date generation and data modification can be achieved using javascript generation. |
There are 2 mode to define or modify output -
-
Generate list of custom attribute value : In this mode user can define list of values for the attribute. To enable this mode uncheck
Apply per row
.
Attribute value will be chosen randomly from the list of value output from the function. -
Generate attribute value per row : In this mode user can define function that will be applied to each row value. To enable this mode check
Apply per row
.
Function will be applied to each row and output will be generated.
This mode is helpful in case you want to modify output of existing attribute value such as doing upper case, lower case etc.
Note
|
To use attribute value from predefined list of attributes use #{}
placeholder. |
Generate List of custom attribute value
This is default mode for javascript generation. Output of generate
function must be list of values which is used as attribute values.
Note
|
Javascript is executed once and result is stored in cache and used for attribute value. |
function generate() {
return #{name.first_name}
.map(value => value.toUpperCase());
}
Output :
[
{
"name": "ROSALINA"
},
{
"name": "LURLINE"
},
{
"name": "KRYSTLE"
},
{
"name": "LEONARDO"
},
{
"name": "THORA"
},
{
"name": "JOYE"
},
{
"name": "VALERY"
},
{
"name": "RANDY"
},
{
"name": "BERNIE"
},
{
"name": "MELDA"
}
]


Generate or Modify Attribute value per row
To modify or replace selected attribute output value, per row javascript function
should be used. Per row function has value
as input which is attribute
value in output data, you can manipulate the value or replace it using javascript.
function generate(value) {
return value.toUpperCase();
}
Output :
[
{
"capital_city": "ACCRA"
},
{
"capital_city": "NUKU'ALOFA"
},
{
"capital_city": "PRAGUE"
},
{
"capital_city": "BEIRUT"
},
{
"capital_city": "VIENTIANE"
},
{
"capital_city": "NASSAU"
},
{
"capital_city": "ADDIS ABABA"
},
{
"capital_city": "RABAT"
},
{
"capital_city": "ANKARA"
},
{
"capital_city": "NAIROBI"
}
]

