{ "info": { "author": "Ulysse Carion", "author_email": "ulysse@segment.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# jddf-python [![PyPI version](https://badge.fury.io/py/jddf.svg)](https://badge.fury.io/py/jddf)\n\n> Documentation on readthedocs.io: https://jddf.readthedocs.io\n\nThis package is a Python implementation of [JSON Data Definition Format][jddf],\na schema language for JSON.\n\n[jddf]: https://jddf.io\n\n## Installation\n\nInstall this package using:\n\n```bash\npip3 install jddf\n```\n\n## Usage\n\nBriefly, here's how you would use this package:\n\n```python\nimport Schema, Validator from jddf\nimport json\n\n# jddf.Schema represents a JDDF Schema.\n#\n# You can parse a jddf.Schema from JSON using Schema.from_json in combination\n# with the standard library's json module.\nschema = Schema.from_json(json.loads(\"\"\"\n {\n \"properties\": {\n \"name\": { \"type\": \"string\" },\n \"age\": { \"type\": \"uint32\" },\n \"phones\": {\n \"elements\": { \"type\": \"string\" }\n }\n }\n }\n\"\"\"))\n\n# jddf.Validator validates inputted data against schemas, and returns a list of\n# validation errors.\n#\n# The exact data in validation errors is part of the JDDF specification, so\n# every implementation of JDDF, across all languages, return the same sort of\n# validation errors.\nvalidator = Validator()\n\n# This input is ok -- it passes all of the rules of the schema. So no validation\n# errors are returned.\nerrors_ok = validator.validate(schema, json.loads(\"\"\"\n {\n \"name\": \"John Doe\",\n \"age\": 43,\n \"phones\": [\"+44 1234567\", \"+44 2345678\"]\n }\n\"\"\"))\n\nprint(errors_ok) # []\n\n# This input has three problems, so three validation errors are returned.\nerrors_bad = validator.validate(schema, json.loads(\"\"\"\n {\n \"age\": \"43\",\n \"phones\": [\"+44 1234567\", 442345678]\n }\n\"\"\"))\n\nprint(len(errors_bad)) # 3\n\n# \"name\" is required\n#\n# [{'instance_path': [], 'schema_path': ['properties', 'name']}]\nprint(errors_bad[0])\n\n# \"age\" has wrong type\n#\n# [{'instance_path': ['age'], 'schema_path': ['properties', 'age', 'type']}]\nprint(errors_bad[1])\n\n# \"phones[1]\" has wrong type\n#\n# [{'instance_path': ['phones', '1'], 'schema_path': ['properties', 'phones', 'elements', 'type']}]\nprint(errors_bad[2])\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jddf/jddf-python", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "jddf", "package_url": "https://pypi.org/project/jddf/", "platform": "", "project_url": "https://pypi.org/project/jddf/", "project_urls": { "Homepage": "https://github.com/jddf/jddf-python" }, "release_url": "https://pypi.org/project/jddf/0.1.2/", "requires_dist": null, "requires_python": ">=3.6", "summary": "JSON Data Definition Format support for Python", "version": "0.1.2", "yanked": false, "yanked_reason": null }, "last_serial": 6113769, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "02ea575980044bc18faf1b315d660e09", "sha256": "a4e568124da475ae29a991d4a1386475cd72ecca9ff231198e99e171f72c1c15" }, "downloads": -1, "filename": "jddf-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "02ea575980044bc18faf1b315d660e09", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 2137, "upload_time": "2019-10-16T17:56:57", "upload_time_iso_8601": "2019-10-16T17:56:57.122606Z", "url": "https://files.pythonhosted.org/packages/2a/21/0d69eaad9ce4f826f575037bf73b0fb8b9b3cc33033a83209ba8e8fe52b8/jddf-0.0.1-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "917f0762b16826f350878dc1c7e2e89a", "sha256": "97d7246c1fd200220e105b4404d40e6d4c2b906be74aade76ff4aeb678df5e61" }, "downloads": -1, "filename": "jddf-0.0.1.tar.gz", "has_sig": false, "md5_digest": "917f0762b16826f350878dc1c7e2e89a", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 1037, "upload_time": "2019-10-16T17:56:59", "upload_time_iso_8601": "2019-10-16T17:56:59.468049Z", "url": "https://files.pythonhosted.org/packages/ef/41/83912cee2bc281520e930d1bc8328945ffeb6998703620293176cd69156f/jddf-0.0.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "45810c6ce00ac3add6a9641da7ba294a", "sha256": "a0a6dadaaa9826a70c6dca640a14e63df333201e2b08ae11c9ff9ebdb8a959b6" }, "downloads": -1, "filename": "jddf-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "45810c6ce00ac3add6a9641da7ba294a", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5543, "upload_time": "2019-10-20T01:56:26", "upload_time_iso_8601": "2019-10-20T01:56:26.625288Z", "url": "https://files.pythonhosted.org/packages/f3/0f/07a2bf7d095aaa5d3641bfc027eaaf84b85c92d2033f1954192ccbf558af/jddf-0.1.0-py3-none-any.whl", "yanked": false, "yanked_reason": null }, { "comment_text": "", "digests": { "md5": "70a9b96e49fb19a8dc5aed0fb7309229", "sha256": "dbdd6f11179dad1aa88e0cf9f1ff5255ccd5d4496a27102b27588b878efd2edf" }, "downloads": -1, "filename": "jddf-0.1.0.tar.gz", "has_sig": false, "md5_digest": "70a9b96e49fb19a8dc5aed0fb7309229", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 3943, "upload_time": "2019-10-20T01:56:30", "upload_time_iso_8601": "2019-10-20T01:56:30.064534Z", "url": "https://files.pythonhosted.org/packages/b6/96/fb83db73797b4dc272851a8b02fef8bb9da789c703c9486704d7e552998e/jddf-0.1.0.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "90f3837bed0fa6799cfcf615d1b76423", "sha256": "68aada17283d5600c91b6f909b624b64fb38c345c86e248766ac61e9171f4deb" }, "downloads": -1, "filename": "jddf-0.1.1.tar.gz", "has_sig": false, "md5_digest": "90f3837bed0fa6799cfcf615d1b76423", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 8238, "upload_time": "2019-10-22T00:29:58", "upload_time_iso_8601": "2019-10-22T00:29:58.763478Z", "url": "https://files.pythonhosted.org/packages/76/8c/1df9c1a32f0716a895dc86a6a2eac9c9987dbbc713b82295c825f0f6e21c/jddf-0.1.1.tar.gz", "yanked": false, "yanked_reason": null } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "7376bbca6190d2c24c04942c3ee4c774", "sha256": "8a87d700f5c2350b2a27019e0d220b0fae26fa6dff5fce624c393ec6f3bfc457" }, "downloads": -1, "filename": "jddf-0.1.2.tar.gz", "has_sig": false, "md5_digest": "7376bbca6190d2c24c04942c3ee4c774", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 8282, "upload_time": "2019-11-11T03:40:34", "upload_time_iso_8601": "2019-11-11T03:40:34.389365Z", "url": "https://files.pythonhosted.org/packages/22/40/c9f8c06246310a69be05fd55e068bd53d5f9900e7e739f62c2adff50b6d1/jddf-0.1.2.tar.gz", "yanked": false, "yanked_reason": null } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7376bbca6190d2c24c04942c3ee4c774", "sha256": "8a87d700f5c2350b2a27019e0d220b0fae26fa6dff5fce624c393ec6f3bfc457" }, "downloads": -1, "filename": "jddf-0.1.2.tar.gz", "has_sig": false, "md5_digest": "7376bbca6190d2c24c04942c3ee4c774", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 8282, "upload_time": "2019-11-11T03:40:34", "upload_time_iso_8601": "2019-11-11T03:40:34.389365Z", "url": "https://files.pythonhosted.org/packages/22/40/c9f8c06246310a69be05fd55e068bd53d5f9900e7e739f62c2adff50b6d1/jddf-0.1.2.tar.gz", "yanked": false, "yanked_reason": null } ], "vulnerabilities": [] }