{ "info": { "author": "Feng Zhou", "author_email": "zf.pascal@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4" ], "description": "yaddle\n======\n\n|Build Status|\n\nYet Another Data format Description LanguagE\n\n::\n\n @role: admin | author | collaborator | \"role with space\"\n\n user:\n name: str{3,20}\n age: int{10,200}\n gender: male | female\n roles: [@role]\n description?: str{,200}\n\ntranslated to json-schema\n\n.. code:: javascript\n\n {\n \"additionalProperties\": false,\n \"definitions\": {\n \"role\": {\n \"enum\": [\n \"admin\",\n \"author\",\n \"collaborator\",\n \"role with space\"\n ]\n }\n },\n \"required\": [\n \"user\"\n ],\n \"type\": \"object\",\n \"properties\": {\n \"user\": {\n \"additionalProperties\": false,\n \"required\": [\n \"name\",\n \"age\",\n \"gender\",\n \"roles\"\n ],\n \"type\": \"object\",\n \"properties\": {\n \"gender\": {\n \"enum\": [\n \"male\",\n \"female\"\n ]\n },\n \"age\": {\n \"minimum\": 10,\n \"type\": \"integer\",\n \"maximum\": 200\n },\n \"name\": {\n \"minLength\": 3,\n \"type\": \"string\",\n \"maxLength\": 20\n },\n \"roles\": {\n \"items\": {\n \"$ref\": \"#/definitions/role\"\n },\n \"type\": \"array\"\n },\n \"description\": {\n \"type\": \"string\",\n \"maxLength\": 200\n }\n }\n }\n }\n }\n\napi\n---\n\nuse load/loads to translate yaddle into json-schema\n\n.. code:: py\n\n from yaddle import load, loads\n load(open(\"some.ydl\"))\n loads(\"\"\"[str]{,3}\"\"\")\n\ncli\n\n.. code:: sh\n\n cat schema.ydl | python -m yaddle.tool\n\nmore details\n------------\n\nnumber\n~~~~~~\n\n::\n\n int{100,200}\n\n.. code:: javascript\n\n {\n \"type\": \"integer\",\n \"minimum\": 100,\n \"maximum\": 200\n }\n\n::\n\n num{,,0.1}\n\n.. code:: javascript\n\n {\n \"type\": \"number\",\n \"multipleOf\": 0.1\n }\n\nstring\n~~~~~~\n\n::\n\n str{1,2} /pattern/\n\n.. code:: javascript\n\n {\n \"type\": \"string\",\n \"minLength\": 1,\n \"maxLength\": 20,\n \"pattern\": \"pattern\"\n }\n\n::\n\n /pattern/\n\n.. code:: javascript\n\n {\n \"type\": \"string\",\n \"pattern\": \"pattern\"\n }\n\nformat ``date-time``, ``email``, ``hostname``, ``ipv4``, ``ipv6``,\n``uri``\n\n::\n\n %email\n\n.. code:: javascript\n\n {\n \"format\": \"email\"\n }\n\narray\n~~~~~\n\n::\n\n [str]{1,10}\n\n.. code:: javascript\n\n {\n \"type\": \"array\",\n \"minItems\": 1,\n \"maxItems\": 10,\n \"items\": {\n \"type\": \"string\"\n }\n }\n\n::\n\n [str|num]\n\n.. code:: javascript\n\n {\n \"type\": \"array\",\n \"items\": {\n oneOf: [\n {\"type\": \"string\"},\n {\"type\": \"number\"}\n ]\n }\n }\n\n::\n\n [str, num]\n\n.. code:: javascript\n\n {\n \"type\": \"array\",\n \"items\": [\n {\"type\": \"string\"},\n {\"type\": \"number\"}\n }\n }\n\n``!`` for uniqueItems\n\n::\n\n [num]!\n\n.. code:: javascript\n\n {\n \"type\": \"array\",\n \"items\": {\n {type: \"number\"}\n },\n \"uniqueItems\": true\n }\n\nobject\n~~~~~~\n\n- all properties are required, except those one with a ``?`` suffix\n- ``...`` to allow ``additionalProperties``\n\n::\n\n key: str\n size?: number\n ...\n\n.. code:: javascript\n\n {\n \"type\": \"object\",\n \"properties\": {\n \"key\": {\n \"type\": \"string\"\n },\n \"size\": {\n \"type\": \"number\"\n },\n \"required\": [\"key\"]\n }\n \"additionalProperties\": true\n }\n\noneOf, anyOf, allOf\n~~~~~~~~~~~~~~~~~~~\n\n- ``|`` for oneOf like ``@ref | @ref2``\n- ``/`` for anyOf\n- ``&`` for allOf\n\nreference\n~~~~~~~~~\n\nlocal reference\n\n::\n\n @address:\n street_address: str\n city: str\n state: str\n\n billing_address: @address\n shipping_address: @address\n\n.. code:: javascript\n\n {\n \"additionalProperties\": false,\n \"definitions\": {\n \"address\": {\n \"additionalProperties\": false,\n \"required\": [\n \"street_address\",\n \"city\",\n \"state\"\n ],\n \"type\": \"object\",\n \"properties\": {\n \"city\": {\n \"type\": \"string\"\n },\n \"state\": {\n \"type\": \"string\"\n },\n \"street_address\": {\n \"type\": \"string\"\n }\n }\n }\n },\n \"required\": [\n \"billing_address\",\n \"shipping_address\"\n ],\n \"type\": \"object\",\n \"properties\": {\n \"billing_address\": {\n \"$ref\": \"#/definitions/address\"\n },\n \"shipping_address\": {\n \"$ref\": \"#/definitions/address\"\n }\n }\n }\n\nreferece remote schema(TBD)\n\n::\n\n @\"http://example.com/schema\"\n\n @product:\n price: num{0,}\n title: str{,200}\n\nreferece it in another schema\n\n::\n\n @example: \"http://example.com/schema\"\n\n products: [@example:product]\n\nexamples\n--------\n\nexample from http://json-schema.org/example2.html translated to yaddle\n\n::\n\n @diskDevice:\n type: disk\n divice: /^/dev/[^/]+(/[^/]+)*$/\n @diskUUID:\n type: disk\n label: /^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$/\n @nfs:\n type: nfs\n remotePath: /^(/[^/]+)+$/\n server: %host-name | %ipv4 | %ipv6\n @tmpfs:\n type: tmpfs\n sizeInMB: int{16,512}\n\n storage: @diskDevice | @diskUUID | @nfs | @tmpfs\n fstype?: ext3 | ext4 | btrfs\n options?: [str]{1,}!\n readonly?: bool\n\n.. |Build Status| image:: https://img.shields.io/travis/zweifisch/yaddle-py.svg?style=flat\n :target: https://travis-ci.org/zweifisch/yaddle-py", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/zweifisch/yaddle-py", "keywords": "json schema", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "yaddle", "package_url": "https://pypi.org/project/yaddle/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/yaddle/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/zweifisch/yaddle-py" }, "release_url": "https://pypi.org/project/yaddle/0.0.2/", "requires_dist": null, "requires_python": null, "summary": "yet another data format description language", "version": "0.0.2" }, "last_serial": 1649659, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "1694e3ddcb9fa64280377279714a96ab", "sha256": "36ac5df5688bbafca0d1bc02786dc9bb2912ae467196d4a39c661e5d4833b683" }, "downloads": -1, "filename": "yaddle-0.0.1.tar.gz", "has_sig": false, "md5_digest": "1694e3ddcb9fa64280377279714a96ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6278, "upload_time": "2015-07-26T00:50:29", "url": "https://files.pythonhosted.org/packages/b6/68/b2fcede0be2949dda24c214528477e98ef82b366302c0a89681de43ba6d2/yaddle-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "9c80f9ded3166eb0e2291af991fdc346", "sha256": "17618907f4a65caabb961682985a4a73df10e966d51e53dc1e1097d392fb592c" }, "downloads": -1, "filename": "yaddle-0.0.2.tar.gz", "has_sig": false, "md5_digest": "9c80f9ded3166eb0e2291af991fdc346", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6350, "upload_time": "2015-07-26T01:33:19", "url": "https://files.pythonhosted.org/packages/c2/5b/b000d075fbc4c011bd42ada92d467d6b595f7a0eb798c0787a81758db568/yaddle-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9c80f9ded3166eb0e2291af991fdc346", "sha256": "17618907f4a65caabb961682985a4a73df10e966d51e53dc1e1097d392fb592c" }, "downloads": -1, "filename": "yaddle-0.0.2.tar.gz", "has_sig": false, "md5_digest": "9c80f9ded3166eb0e2291af991fdc346", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6350, "upload_time": "2015-07-26T01:33:19", "url": "https://files.pythonhosted.org/packages/c2/5b/b000d075fbc4c011bd42ada92d467d6b595f7a0eb798c0787a81758db568/yaddle-0.0.2.tar.gz" } ] }