Skip to main content

Transformation functions

someKeys

Commentary

added in 0.0.5

Selects one or more keys from an object at random. Most useful combined with previousEvent to model an old event with some randomly added changes.


Examples

Selecting subsets of keys

{
"_gen": "someKeys",
"object": {
"firstName": {
"_gen": "string",
"expr": "#{Name.firstName}"
},
"lastName": {
"_gen": "string",
"expr": "#{Name.lastName}"
}
}
}
[
{
"firstName": "Gerard",
"lastName": "Morar"
},
{
"firstName": "Odell"
},
{
"firstName": "Verona",
"lastName": "Smitham"
},
{
"firstName": "Jacklyn"
},
{
"firstName": "Pablo"
}
]

Specification

JSON schema

{
"type": "object",
"properties": {
"object": {
"type": "object",
"minProperties": 1
}
},
"required": [
"object"
]
}