Rx: Simple, Extensible Schemata
//any
Any has two uses: either it accepts absolutely any value (including the lack of a value) or it accepts a value accepted by any of a list of alternatives. These two forms look like this:
Match absolutely anything:
{ "type": "//any" }
Match either no value or an integer from 1 to 6:
{
"type": "//any",
"of": [
"//nil",
{ "type": "//int", "range": { "min": 1, "max": 6 } }
]
}
"of" is the only permissible for //any, and if given it must be a list of one or more valid schema definitions.
/.meta/any, the schema for //any definitions:
{
"type": "//rec",
"required": {
"type": { "type": "//str", "value": "//any" },
},
"optional": {
"of": {
"type": "/arr",
"contents": "/.meta/schema",
"length": { "min": 1 },
}
}
}