Eventvisor

Concepts

JSON Schema

Eventvisor makes use of a subset of the JSON Schema specification when defining attribute and event schemas.

Supported types are listed below:

string

For simple strings (text values):

type: string

enum

You can specify a list of allowed values for a string:

type: string
enum:
- foo
- bar

maxLength

You can specify the maximum length for a string:

type: string
maxLength: 100

minLength

You can specify the minimum length for a string:

type: string
minLength: 0

pattern

You can specify a regular expression for a string:

type: string
pattern: ^[a-z]+$

boolean

For boolean (true/false) values:

type: boolean

number

For numeric values (integer or float):

type: number

maximum

You can specify the maximum value for a number:

type: number
maximum: 100

minimum

You can specify the minimum value for a number:

type: number
minimum: 0

integer

For whole numbers only:

type: integer

Similar to number, you can also specify the maximum and minimum values for an integer.

object

For objects (key-value pairs):

type: object
properties:
firstProperty:
type: string
secondProperty:
type: number
required:
- firstProperty

Nested objects

You can also define nested objects:

type: object
properties:
firstProperty:
type: string
nested:
type: object
properties:
foo:
type: string
bar:
type: string
required:
- foo
- bar
required:
- firstProperty

array

For arrays:

type: array
items:
type: string

When inside an object:

type: object
properties:
arrayProperty:
type: array
items:
type: string
required:
- arrayProperty

maxItems

You can specify the maximum number of items for an array:

type: array
maxItems: 100

minItems

You can specify the minimum number of items for an array:

type: array
minItems: 0

uniqueItems

You can specify if the items in the array should be unique:

type: array
uniqueItems: true

Common properties

You can make use of the following properties for all types above:

const

You can specify a constant value:

type: string
const: "foo"

default

You can specify a default value:

type: string
default: "default value"
Previous
Effects