{ "info": { "author": "Oliver Tonnhofer", "author_email": "olt@omniscale.de", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.5", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7" ], "description": "dictspec \u2013 Validator for JSON/YAML/dicts\n========================================\n\ndictspec is a simple Python library that validates dictionary and list based data structures.\nYou can use it to validate JSON/YAML documents against your own specification.\n\nIt is MIT licensed and uses relative imports, so you can just drop it into your project.\n\nExamples\n--------\n\nValidate against plain Python data objects or types:\n\n >>> spec = {\n ... 'foo': 1,\n ... 'bar': [basestring],\n ... }\n >>> data = {\n ... 'foo': 4,\n ... 'bar': ['hello', u'w\\x00F6rld']}\n ... }\n >>> from dictspec.validator import validate\n >>> validate(spec, data)\n\n\nUse more complex specs and get detailed errors:\n\n >>> from dictspec.spec import number, required\n >>> spec = {\n ... required('foo'): number(),\n ... 'bar': bool(),\n ... }\n >>> data = {\n ... # missing 'foo' key\n ... 'bar': 4, # wrong type\n ... 'baz': True, # unknown key\n ... }\n \n >>> from dictspec.validator import ValidationError\n >>> try:\n ... validate(spec, data)\n ... except ValidationError, ex:\n ... print ex.errors\n [\"missing 'foo' not in .\", \"unknown 'baz' in .\", '4 in bar not of type bool']\n\n\nAlso with recursion and arbitrary keys:\n\n >>> from dictspec.spec import anything, recursive\n >>> spec = {\n ... 'hello': recursive({\n ... anything(): recursive(),\n ... })\n ... }\n >>> data = {\n ... 'hello': {'any': {'thing': {'recursive':{}}}}\n ... }\n >>> validate(spec, data)", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.org/olt/dictspec/", "keywords": null, "license": "MIT License", "maintainer": null, "maintainer_email": null, "name": "dictspec", "package_url": "https://pypi.org/project/dictspec/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/dictspec/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.org/olt/dictspec/" }, "release_url": "https://pypi.org/project/dictspec/0.2.1/", "requires_dist": null, "requires_python": null, "summary": "validator for JSON/YAML/dict data", "version": "0.2.1" }, "last_serial": 2222761, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "6450a912e3fa6e1e150deb40962be8b6", "sha256": "e034a12f66136b2fce1af5a25246a3112d05bc7b200e974da1954c83d6340add" }, "downloads": -1, "filename": "dictspec-0.2.tar.gz", "has_sig": false, "md5_digest": "6450a912e3fa6e1e150deb40962be8b6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6117, "upload_time": "2016-07-14T12:26:38", "url": "https://files.pythonhosted.org/packages/b2/1a/f5159bd414cb37b25362dda3541486c164861fda971e7428ae01dbcddc16/dictspec-0.2.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "dd9f1e4b3e0d2cb9bcb5e3530e823d8e", "sha256": "305568ce191759b410047cecdcec16534f0580e5f33a740eb8965ad56557d14d" }, "downloads": -1, "filename": "dictspec-0.2.1.tar.gz", "has_sig": false, "md5_digest": "dd9f1e4b3e0d2cb9bcb5e3530e823d8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6324, "upload_time": "2016-07-15T09:52:44", "url": "https://files.pythonhosted.org/packages/43/4b/bfa11631ea2d26ccf0b244f4a1a0583e92c6586f5c8df3d051c880238dca/dictspec-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "dd9f1e4b3e0d2cb9bcb5e3530e823d8e", "sha256": "305568ce191759b410047cecdcec16534f0580e5f33a740eb8965ad56557d14d" }, "downloads": -1, "filename": "dictspec-0.2.1.tar.gz", "has_sig": false, "md5_digest": "dd9f1e4b3e0d2cb9bcb5e3530e823d8e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6324, "upload_time": "2016-07-15T09:52:44", "url": "https://files.pythonhosted.org/packages/43/4b/bfa11631ea2d26ccf0b244f4a1a0583e92c6586f5c8df3d051c880238dca/dictspec-0.2.1.tar.gz" } ] }