https://github.com/zweifisch/yaddle
Yet Another Data format Description Language
https://github.com/zweifisch/yaddle
Last synced: 2 months ago
JSON representation
Yet Another Data format Description Language
- Host: GitHub
- URL: https://github.com/zweifisch/yaddle
- Owner: zweifisch
- Created: 2015-05-29T07:05:56.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2015-08-06T14:32:24.000Z (almost 11 years ago)
- Last Synced: 2024-02-23T17:47:02.827Z (over 2 years ago)
- Language: JavaScript
- Size: 145 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# yaddle
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]
Yet Another Data format Description LanguagE
```yaml
@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
```javascript
{
"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
```js
require("babel/polyfill");
var yaddle = require("yaddle");
yaddle.load("some.ydl").then(...);
yaddle.loads(schema).then(...);
```
## more details
see [yaddle-py](https://github.com/zweifisch/yaddle-py#more-details)
[npm-image]: https://img.shields.io/npm/v/yaddle.svg?style=flat
[npm-url]: https://npmjs.org/package/yaddle
[travis-image]: https://img.shields.io/travis/zweifisch/yaddle.svg?style=flat
[travis-url]: https://travis-ci.org/zweifisch/yaddle