schema.enum

A convenience stream built withcore.select that exists to support the JSON Schema enum keyword. If a stream does not have a type, but does include the enum attribute,schema.enum will be inferred.

Attributes

enumrequired

An array of JSON values to be emitted, selected at random.

Examples

Consider this stream definition, which is also valid JSON Schema:

{
  "enum": [41, { "name": "Jim" }]
}

It is inferred to be:

{
  "type": "schema.enum",
  "enum": [41, { "name": "Jim" }]
}

Which is implemented as:

{
  "type": "core.select",
  "options": [
    {
      "weight": 1,
      "stream": {
        "type": "core.constant",
        "value": 41
      }
    },
    {
      "weight": 1,
      "stream": {
        "type": "core.constant",
        "value": { "name": "Jim" }
      }
    }
  ]
}