anyOf
The anyOf
generator generates one or multiple random value(s) from a list of possible values.
This generator has two inputs:
values
: An array of possible values to generate from. These values may be any generator.num
: The number of values to generate. Defaults to1
. If set to0
, all values will be generated. If set to a negative number, a random number of values will be generated.allowNull
: Whether to allow no elements being generated whennum
is set to a negative number. Ifnum
is not defined or set to a positive number, this doesn't do anything. Defaults tofalse
.
Examples
Generate a random value from a list of possible values:
{
"type": "anyOf",
"values": [
{
"type": "string",
"value": "test"
},
{
"type": "string",
"value": "test2"
}
]
}
Generate a random number of values from a list of possible values:
{
"type": "anyOf",
"num": -1,
"values": [
{
"type": "string",
"value": "test"
},
{
"type": "string",
"value": "test2"
}
]
}