Stream
A stream defines the schema and content of an unbounded sequence of JSON values. They are used by entities to simulate a dataset.
Consider the following stream definition:
type: object
properties:
email:
type: function
expression: username + '@' + domain
variables:
username:
type: string
maxLength: 10
domain:
type: enum
enum:
- example.com
- example.org
age:
type: integer
minimum: 0
maximum: 120
It will endlessly produce values that look like this:
{ "email": "kjandfa@example.com", "age": 16 }
{ "email": "9jsm348vk@example.org", "age": 77 }
{ "email": "111//??@example.org", "age": 58 }
The first thing to note is that every stream definition must specify a type
field, which acts as a discriminant - i.e., it determines the other fields that may be specified in the definition.
In the above example, the top-level definition has type object
, which requires aproperties
parameter while theage
property has typeinteger
, which accepts optionalminimum
andmaximum
parameters.
The second thing to note is that stream types are composable - some "higher level" stream types accept other stream definitons as parameters
In the above example, we specify streams in the variables
parameter of the function
stream defintion which is itself specified as part of the properties
parameter of the top-levelobject
stream definition.
See the streams reference for all available streams.