{ "info": { "author": "R\u00e9my Hubscher", "author_email": "hubscher.remy@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application" ], "description": "What is Rx?\n===========\n\nWhen adding an API to your web service, you have to choose how to encode the\ndata you send across the line. XML is one common choice for this, but it can\ngrow arcane and cumbersome pretty quickly. Lots of webservice authors want to\navoid thinking about XML, and instead choose formats that provide a few simple\ndata types that correspond to common data structures in modern programming\nlanguages. In other words, JSON and YAML.\n\nUnfortunately, while these formats make it easy to pass around complex data\nstructures, they lack a system for validation. XML has XML Schemas and RELAX\nNG, but these are complicated and sometimes confusing standards. They're not\nvery portable to the kind of data structure provided by JSON, and if you wanted\nto avoid XML as a data encoding, writing more XML to validate the first XML is\nprobably even less appealing.\n\nRx is meant to provide a system for data validation that matches up with\nJSON-style data structures and is as easy to work with as JSON itself.\n\nrxjson\n======\n\nrxjson is a python package that helps you validate your generated JSON\nagainst a standardized json schema directly in your python app.\n\nIt is a packaged version of http://rx.codesimply.com/\n\n.. image:: https://secure.travis-ci.org/spiral-project/rxjson.png\n :target: http://travis-ci.org/spiral-project/rxjson/\n :alt: Travis-ci: continuous integration status.\n\nUsage\n=====\n\nHere is a little example of how to validate your json against a rx schema:\n\n.. code-block:: python\n\n import requests\n from rxjson import Rx\n import unittest\n \n class SporeTest(unittest.TestCase):\n \"\"\"Test generate spore schema.\"\"\"\n def test_spore(self):\n rx = Rx.Factory({ \"register_core_types\": True })\n with open('spore_validation.rx') as f:\n spore_json_schema = json.loads(f.read())\n spore_schema = rx.make_schema(spore_json_schema)\n resp = requests.get('http://localhost:8000/spore', headers={'Content-Type': 'application/json'})\n self.assertTrue(spore_schema.check(resp.json))\n\nOr even quicker:\n\n.. code-block:: python\n\n >>> import json\n >>> from rxjson import Rx\n >>> rx = Rx.Factory({ \"register_core_types\": True })\n >>> spore_json_schema = json.loads(open('spore_validation.rx').read())\n >>> spore_schema = rx.make_schema(spore_json_schema)\n >>> js = json.loads(\"\"\"{\n ... \"base_url\": \"http://localhost:8000\",\n ... \"expected_status\": [200],\n ... \"version\": \"0.1\",\n ... \"methods\": {\n ... \"put_data_item\": {\n ... \"path\": \"/data/:model_name/:data_item_id\",\n ... \"description\": \"Update a data item.\",\n ... \"required_params\": [\"model_name\", \"data_item_id\"],\n ... \"method\": \"PUT\",\n ... \"formats\": [\"json\"]\n ... }\n ... },\n ... \"name\": \"daybed\"\n ... }\"\"\")\n >>> spore_schema.check(js)\n True\n\n* ``spore_validation.rx`` is part of https://github.com/SPORE/specifications\n* ``daybed`` is a form model validation API: https://github.com/spiral-project/daybed", "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/spiral-project/rxjson", "keywords": "json schema validation rx rxjson", "license": "GPLv2.0", "maintainer": null, "maintainer_email": null, "name": "rxjson", "package_url": "https://pypi.org/project/rxjson/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/rxjson/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/spiral-project/rxjson" }, "release_url": "https://pypi.org/project/rxjson/0.3/", "requires_dist": null, "requires_python": null, "summary": "JSON RX Schema validation tool", "version": "0.3" }, "last_serial": 1589534, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "f1b3d5cb8604886dbc233cf49e6250f9", "sha256": "37c9616c5f8afaca81e2bcf75c5a22f6ca4968fe5c0356f42cd43252387fe30a" }, "downloads": -1, "filename": "rxjson-0.1.tar.gz", "has_sig": false, "md5_digest": "f1b3d5cb8604886dbc233cf49e6250f9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4729, "upload_time": "2012-10-22T12:56:18", "url": "https://files.pythonhosted.org/packages/b3/10/661c1c870212cee6c2c5bf2fcc6594bc9ac97022be25a728d56f4ecb1387/rxjson-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "0c4516b39ab02f41275ec1e4153d2ecf", "sha256": "a5356253b4f24f72895f686edcec50482be0ebc2ec97495f13dffb08dc0d66fa" }, "downloads": -1, "filename": "rxjson-0.2.tar.gz", "has_sig": false, "md5_digest": "0c4516b39ab02f41275ec1e4153d2ecf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4798, "upload_time": "2013-02-12T15:51:47", "url": "https://files.pythonhosted.org/packages/51/c8/38118c6429dd2ce2e45e2060baf7c1b2d76d704910cbd797f9236266c1a8/rxjson-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "e3dbc9b395193db1b76bd27344e4402d", "sha256": "2ed3d5dadf9e8aef2ef1f3cdfa3cf9abae99c9eac5a2db0267f17a9dae3a66e1" }, "downloads": -1, "filename": "rxjson-0.3.zip", "has_sig": false, "md5_digest": "e3dbc9b395193db1b76bd27344e4402d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9694, "upload_time": "2015-06-12T12:15:24", "url": "https://files.pythonhosted.org/packages/0a/66/a34442065708bf6416af43d6285129b5b806eecee2f04926f63998eda170/rxjson-0.3.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e3dbc9b395193db1b76bd27344e4402d", "sha256": "2ed3d5dadf9e8aef2ef1f3cdfa3cf9abae99c9eac5a2db0267f17a9dae3a66e1" }, "downloads": -1, "filename": "rxjson-0.3.zip", "has_sig": false, "md5_digest": "e3dbc9b395193db1b76bd27344e4402d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9694, "upload_time": "2015-06-12T12:15:24", "url": "https://files.pythonhosted.org/packages/0a/66/a34442065708bf6416af43d6285129b5b806eecee2f04926f63998eda170/rxjson-0.3.zip" } ] }