validictory


Namevalidictory JSON
Version 1.1.3 PyPI version JSON
download
home_pagehttp://github.com/jamesturk/validictory
Summarygeneral purpose python data validator
upload_time2024-01-14 21:39:34
maintainer
docs_urlNone
authorJames Turk
requires_python
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ===========
validictory
===========

:warning: **:warning: As of 2018 this library is deprecated, please consider using jsonschema (https://pypi.python.org/pypi/jsonschema) instead.**


.. image:: https://travis-ci.org/jamesturk/validictory.svg?branch=master
    :target: https://travis-ci.org/jamesturk/validictory

.. image:: https://coveralls.io/repos/jamesturk/validictory/badge.png?branch=master
    :target: https://coveralls.io/r/jamesturk/validictory

.. image:: https://img.shields.io/pypi/v/validictory.svg
    :target: https://pypi.python.org/pypi/validictory

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


A general purpose Python data validator.

Schema format based on JSON Schema Proposal (http://json-schema.org)

Contains code derived from jsonschema, by Ian Lewis and Yusuke Muraoka.

Usage
=====

JSON documents and schema must first be loaded into a Python dictionary type
before it can be validated.

Parsing a simple JSON document::

    >>> import validictory
    >>>
    >>> validictory.validate("something", {"type":"string"})

Parsing a more complex JSON document::

    >>> import json
    >>> import validictory
    >>>
    >>> data = json.loads('["foo", {"bar":["baz", null, 1.0, 2]}]')
    >>> schema = {
    ...   "type":"array",
    ...   "items":[
    ...     {"type":"string"},
    ...     {"type":"object",
    ...      "properties":{
    ...        "bar":{
    ...          "items":[
    ...            {"type":"string"},
    ...            {"type":"any"},
    ...            {"type":"number"},
    ...            {"type":"integer"}
    ...          ]
    ...        }
    ...      }
    ...    }
    ...   ]
    ... }
    >>> validictory.validate(data,schema)

Catch ValueErrors to handle validation issues::

    >>> import validictory
    >>>
    >>> try:
    ...     validictory.validate("something", {"type":"string","minLength":15})
    ... except ValueError, error:
    ...     print(error)
    ...
    Length of value 'something' for field '_data' must be greater than or equal to 15

You can read more in the official documentation at `Read the Docs <http://validictory.readthedocs.org/en/latest/>`_.

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/jamesturk/validictory",
    "name": "validictory",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "James Turk",
    "author_email": "james.p.turk@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/65/e3/7187ee9ea54823dbaabedf22f56a511e5d049b6c4fc200e78386aa132521/validictory-1.1.3.tar.gz",
    "platform": null,
    "description": "===========\nvalidictory\n===========\n\n:warning: **:warning: As of 2018 this library is deprecated, please consider using jsonschema (https://pypi.python.org/pypi/jsonschema) instead.**\n\n\n.. image:: https://travis-ci.org/jamesturk/validictory.svg?branch=master\n    :target: https://travis-ci.org/jamesturk/validictory\n\n.. image:: https://coveralls.io/repos/jamesturk/validictory/badge.png?branch=master\n    :target: https://coveralls.io/r/jamesturk/validictory\n\n.. image:: https://img.shields.io/pypi/v/validictory.svg\n    :target: https://pypi.python.org/pypi/validictory\n\n.. image:: https://readthedocs.org/projects/validictory/badge/?version=latest\n    :target: https://readthedocs.org/projects/validictory/?badge=latest\n    :alt: Documentation Status\n\n\nA general purpose Python data validator.\n\nSchema format based on JSON Schema Proposal (http://json-schema.org)\n\nContains code derived from jsonschema, by Ian Lewis and Yusuke Muraoka.\n\nUsage\n=====\n\nJSON documents and schema must first be loaded into a Python dictionary type\nbefore it can be validated.\n\nParsing a simple JSON document::\n\n    >>> import validictory\n    >>>\n    >>> validictory.validate(\"something\", {\"type\":\"string\"})\n\nParsing a more complex JSON document::\n\n    >>> import json\n    >>> import validictory\n    >>>\n    >>> data = json.loads('[\"foo\", {\"bar\":[\"baz\", null, 1.0, 2]}]')\n    >>> schema = {\n    ...   \"type\":\"array\",\n    ...   \"items\":[\n    ...     {\"type\":\"string\"},\n    ...     {\"type\":\"object\",\n    ...      \"properties\":{\n    ...        \"bar\":{\n    ...          \"items\":[\n    ...            {\"type\":\"string\"},\n    ...            {\"type\":\"any\"},\n    ...            {\"type\":\"number\"},\n    ...            {\"type\":\"integer\"}\n    ...          ]\n    ...        }\n    ...      }\n    ...    }\n    ...   ]\n    ... }\n    >>> validictory.validate(data,schema)\n\nCatch ValueErrors to handle validation issues::\n\n    >>> import validictory\n    >>>\n    >>> try:\n    ...     validictory.validate(\"something\", {\"type\":\"string\",\"minLength\":15})\n    ... except ValueError, error:\n    ...     print(error)\n    ...\n    Length of value 'something' for field '_data' must be greater than or equal to 15\n\nYou can read more in the official documentation at `Read the Docs <http://validictory.readthedocs.org/en/latest/>`_.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "general purpose python data validator",
    "version": "1.1.3",
    "project_urls": {
        "Homepage": "http://github.com/jamesturk/validictory"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ba2be78293195d5792fb407383ba4f6cc3968319205ba6ae4d0c42c66481c736",
                "md5": "d018f32fe2ac55078f991640773f67e6",
                "sha256": "c79301de102e4ed751bf1a66b3d091b913fa830623f2dfe68067cb023e3e55f5"
            },
            "downloads": -1,
            "filename": "validictory-1.1.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d018f32fe2ac55078f991640773f67e6",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 11327,
            "upload_time": "2024-01-14T21:39:32",
            "upload_time_iso_8601": "2024-01-14T21:39:32.361130Z",
            "url": "https://files.pythonhosted.org/packages/ba/2b/e78293195d5792fb407383ba4f6cc3968319205ba6ae4d0c42c66481c736/validictory-1.1.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "65e37187ee9ea54823dbaabedf22f56a511e5d049b6c4fc200e78386aa132521",
                "md5": "4d0e3994da15306e52d10dd1008de8a7",
                "sha256": "fba9fb4d5cdc349090ac1cf22d4e021bdaeff391c91cb47ab6eadba9967921c8"
            },
            "downloads": -1,
            "filename": "validictory-1.1.3.tar.gz",
            "has_sig": false,
            "md5_digest": "4d0e3994da15306e52d10dd1008de8a7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 29867,
            "upload_time": "2024-01-14T21:39:34",
            "upload_time_iso_8601": "2024-01-14T21:39:34.912206Z",
            "url": "https://files.pythonhosted.org/packages/65/e3/7187ee9ea54823dbaabedf22f56a511e5d049b6c4fc200e78386aa132521/validictory-1.1.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-14 21:39:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jamesturk",
    "github_project": "validictory",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "validictory"
}
        
Elapsed time: 0.16143s