jsl


Namejsl JSON
Version 0.2.4 PyPI version JSON
download
home_pagehttps://jsl.readthedocs.org
SummaryA Python DSL for defining JSON schemas
upload_time2016-05-11 18:26:39
maintainerNone
docs_urlNone
authorAnton Romanovich
requires_pythonNone
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            JSL
===

.. image:: https://travis-ci.org/aromanovich/jsl.svg?branch=master
    :target: https://travis-ci.org/aromanovich/jsl
    :alt: Build Status

.. image:: https://coveralls.io/repos/aromanovich/jsl/badge.svg?branch=master
    :target: https://coveralls.io/r/aromanovich/jsl?branch=master
    :alt: Coverage

.. image:: https://readthedocs.org/projects/jsl/badge/?version=latest
    :target: https://readthedocs.org/projects/jsl/
    :alt: Documentation

.. image:: http://img.shields.io/pypi/v/jsl.svg
    :target: https://pypi.python.org/pypi/jsl
    :alt: PyPI Version

.. image:: http://img.shields.io/pypi/dm/jsl.svg
    :target: https://pypi.python.org/pypi/jsl
    :alt: PyPI Downloads

Documentation_ | GitHub_ |  PyPI_

JSL is a Python DSL for defining JSON Schemas.

Example
-------

::

    import jsl

    class Entry(jsl.Document):
        name = jsl.StringField(required=True)

    class File(Entry):
        content = jsl.StringField(required=True)

    class Directory(Entry):
        content = jsl.ArrayField(jsl.OneOfField([
            jsl.DocumentField(File, as_ref=True),
            jsl.DocumentField(jsl.RECURSIVE_REFERENCE_CONSTANT)
        ]), required=True)

``Directory.get_schema(ordered=True)`` will return the following JSON schema:

::

    {
        "$schema": "http://json-schema.org/draft-04/schema#",
        "definitions": {
            "directory": {
                "type": "object",
                "properties": {
                    "name": {"type": "string"},
                    "content": {
                        "type": "array",
                        "items": {
                            "oneOf": [
                                {"$ref": "#/definitions/file"},
                                {"$ref": "#/definitions/directory"}
                            ]
                        }
                    }
                },
                "required": ["name", "content"],
                "additionalProperties": false
            },
            "file": {
                "type": "object",
                "properties": {
                    "name": {"type": "string"},
                    "content": {"type": "string"}
                },
                "required": ["name", "content"],
                "additionalProperties": false
            }
        },
        "$ref": "#/definitions/directory"
    }

Installing
----------

::

    pip install jsl

License
-------

`BSD license`_

.. _Documentation: http://jsl.readthedocs.org/
.. _GitHub: https://github.com/aromanovich/jsl
.. _PyPI: https://pypi.python.org/pypi/jsl
.. _BSD license: https://github.com/aromanovich/jsl/blob/master/LICENSE
            

Raw data

            {
    "_id": null,
    "home_page": "https://jsl.readthedocs.org",
    "name": "jsl",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Anton Romanovich",
    "author_email": "anthony.romanovich@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/c1/63/47d4bc4e4bfae29e00ff9256b52dfbf945b409804cfadf95714c113b8efb/jsl-0.2.4.tar.gz",
    "platform": "UNKNOWN",
    "description": "JSL\n===\n\n.. image:: https://travis-ci.org/aromanovich/jsl.svg?branch=master\n    :target: https://travis-ci.org/aromanovich/jsl\n    :alt: Build Status\n\n.. image:: https://coveralls.io/repos/aromanovich/jsl/badge.svg?branch=master\n    :target: https://coveralls.io/r/aromanovich/jsl?branch=master\n    :alt: Coverage\n\n.. image:: https://readthedocs.org/projects/jsl/badge/?version=latest\n    :target: https://readthedocs.org/projects/jsl/\n    :alt: Documentation\n\n.. image:: http://img.shields.io/pypi/v/jsl.svg\n    :target: https://pypi.python.org/pypi/jsl\n    :alt: PyPI Version\n\n.. image:: http://img.shields.io/pypi/dm/jsl.svg\n    :target: https://pypi.python.org/pypi/jsl\n    :alt: PyPI Downloads\n\nDocumentation_ | GitHub_ |  PyPI_\n\nJSL is a Python DSL for defining JSON Schemas.\n\nExample\n-------\n\n::\n\n    import jsl\n\n    class Entry(jsl.Document):\n        name = jsl.StringField(required=True)\n\n    class File(Entry):\n        content = jsl.StringField(required=True)\n\n    class Directory(Entry):\n        content = jsl.ArrayField(jsl.OneOfField([\n            jsl.DocumentField(File, as_ref=True),\n            jsl.DocumentField(jsl.RECURSIVE_REFERENCE_CONSTANT)\n        ]), required=True)\n\n``Directory.get_schema(ordered=True)`` will return the following JSON schema:\n\n::\n\n    {\n        \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n        \"definitions\": {\n            \"directory\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"name\": {\"type\": \"string\"},\n                    \"content\": {\n                        \"type\": \"array\",\n                        \"items\": {\n                            \"oneOf\": [\n                                {\"$ref\": \"#/definitions/file\"},\n                                {\"$ref\": \"#/definitions/directory\"}\n                            ]\n                        }\n                    }\n                },\n                \"required\": [\"name\", \"content\"],\n                \"additionalProperties\": false\n            },\n            \"file\": {\n                \"type\": \"object\",\n                \"properties\": {\n                    \"name\": {\"type\": \"string\"},\n                    \"content\": {\"type\": \"string\"}\n                },\n                \"required\": [\"name\", \"content\"],\n                \"additionalProperties\": false\n            }\n        },\n        \"$ref\": \"#/definitions/directory\"\n    }\n\nInstalling\n----------\n\n::\n\n    pip install jsl\n\nLicense\n-------\n\n`BSD license`_\n\n.. _Documentation: http://jsl.readthedocs.org/\n.. _GitHub: https://github.com/aromanovich/jsl\n.. _PyPI: https://pypi.python.org/pypi/jsl\n.. _BSD license: https://github.com/aromanovich/jsl/blob/master/LICENSE",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "A Python DSL for defining JSON schemas",
    "version": "0.2.4",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c16347d4bc4e4bfae29e00ff9256b52dfbf945b409804cfadf95714c113b8efb",
                "md5": "e51e9bf3cc294af204f0b20938cf4682",
                "sha256": "222621116b6ff508f12b2d9e17a576d08d618b06c0845b1867b000a90424c19d"
            },
            "downloads": -1,
            "filename": "jsl-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "e51e9bf3cc294af204f0b20938cf4682",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21015,
            "upload_time": "2016-05-11T18:26:39",
            "upload_time_iso_8601": "2016-05-11T18:26:39.099033Z",
            "url": "https://files.pythonhosted.org/packages/c1/63/47d4bc4e4bfae29e00ff9256b52dfbf945b409804cfadf95714c113b8efb/jsl-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2016-05-11 18:26:39",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "jsl"
}
        
Elapsed time: 0.03213s