yaddle
v0.1.2
Published
Yet Another Data Format Description Language
Downloads
4
Readme
yaddle
Yet Another Data format Description LanguagE
@role: admin | author | collaborator | "role with space"
user:
name: str{3,20}
age: int{10,200}
gender: male | female
roles: [@role]
description?: str{,200}
translate to json-schema
{
"type": "object",
"properties": {
"user": {
"type": "object",
"properties": {
"name": {
"type": "string",
"minLength": 3,
"maxLength": 20
},
"age": {
"type": "integer",
"minimum": 10,
"maximum": 200
},
"gender": {
"enum": [
"male",
"female"
]
},
"roles": {
"type": "array",
"items": {
"$ref": "#/definitions/role"
}
},
"description": {
"type": "string",
"maxLength": 200
}
},
"required": [
"name",
"age",
"gender",
"roles"
],
"additionalProperties": false
}
},
"required": [
"user"
],
"additionalProperties": false,
"definitions": {
"role": {
"enum": [
"admin",
"author",
"collaborator",
"role with space"
]
}
}
}
api
require("babel/polyfill");
var yaddle = require("yaddle");
yaddle.load("some.ydl").then(...);
yaddle.loads(schema).then(...);
more details
see yaddle-py