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": "Chantel",
"lastName": "Ledner"
},
{
"lastName": "Smith"
},
{
"lastName": "Parisian"
},
{
"firstName": "Jarrett"
},
{
"firstName": "Migdalia",
"lastName": "Murphy"
}
]

Specification

JSON schema

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