Transform tagged template strings with orderly syntax into JSON schema.
{"plugins":["orderly"]}
var schema = orderly`
object {
integer {0,200} age;
object {
string first;
string last;
}* name;
}*;
`
var schema = {
"type": "object",
"properties": {
"age": {
"type": "integer",
"minimum": 0,
"maximum": 200
},
"name": {
"type": "object",
"properties": {
"first": {
"type": "string"
},
"last": {
"type": "string"
}
}
}
}
};
I did this mostly to get my feet wet with the babel plugin API.
orderly is only 25kb, so more than likely you can just add it to your project and no one will notice.
I plan to make other plugins for languages that use JISON, but a stateless language that transpiles to JSON seemed easier than other JISON based languages.