The type system is based on the following primitives:
There are two collection types:
And two special types:
New types can be defined using a combination of these core types and constraints.
Examples:
{
...
"types": {
"integer": "number[numbers.integer]",
"positive": "number[numbers.positive]",
"longstring": "string[strings.minLength 150]",
"state": "string[enum on off]"
}
}
The collection types can have a generic constraint:
{
...
"types": {
"strings": "list<string>",
"longstrings": "list<string[strings.minLength 150]>",
"numbers": "map<number>",
"floats": "map<number[numbers.float]>"
}
A map that has a specific set of keys, but the definition is different:
{
...
"types": {
"name": "string[strings.between 2 15]",
"user": {
"id": "string[strings.exactLength 32]"
"username": "string[strings.between 5 20]",
"name": {
"first": "name",
"last": "name"
}
}
}