{ "info": { "author": "William Clemens", "author_email": "wesclemens@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Flask-JsonSchemaValidator\n\nBasic JSON Schema Validator for the [Flask](http://flask.pocoo.org/) web framework.\n\n## Usage\n\nBasic usage is to apply the `@validate` decorator to a route. If request validates the route will be called as normal. If the request doesn't validate an error message will be genrated and a `400 BAD REQUEST` will be returned with the error message in the body.\n\n```\nvalidate(schema, force=False, json_cache=True)\n```\nschema: [jsonschema](http://json-schema.org/) to validate against\n\nforce: try to validate request if `Content-Type` is not `applciation/json` \n\njson_cache: cache json with `flask.request.get_json` \n\n\n### Example\n\n```python\nfrom flask_jsonschema import validate\n\n@app.route(\"/\", methods=['POST'])\n@validate({\n\t 'type': 'object',\n\t 'properties': {\n\t 'foo': {'type': 'string'},\n\t 'bar': {'type': 'number'},\n\t },\n\t 'required': ['bar', 'foo'],\n\t })\ndef index_post():\n return flask.jsonify(\n time=time.strftime(\"%Y-%m-%d %H:%M:%S\", time.gmtime())\n )\n```\n\n#### Valid Request\n\nRequest:\n\n```http\nPOST / HTTP/1.1\nContent-Type: application/json\nHost: localhost:5000\nContent-Length: 26\n\n{\"foo\":\"String\",\"bar\":123}\n```\n\nResponse:\n\n```http\nHTTP/1.0 200 OK\nContent-Type: application/json\nContent-Length: 35\nServer: Werkzeug/0.10.4 Python/3.4.3\nDate: Thu, 27 Aug 2015 04:05:24 GMT\n\n{\n \"time\": \"2015-08-27 04:05:24\"\n}\n```\n#### Invalid Request\n\nRequest:\n\n```http\nPOST / HTTP/1.1\nContent-Type: application/json\nHost: localhost:5000\nContent-Length: 37\n\n{\"foo\":\"String\",\"bar\":\"Not a number\"}\n```\n\nResponse:\n\n```http\nHTTP/1.0 400 BAD REQUEST\nContent-Type: application/json\nContent-Length: 145\nServer: Werkzeug/0.10.4 Python/3.4.3\nDate: Thu, 27 Aug 2015 03:53:39 GMT\n\n{\n \"error_message\": \"'Not a number' is not of type 'number'\",\n \"error_path\": \"(root).bar\",\n \"status\": 400,\n \"status_message\": \"Bad Request\"\n}\n```\n\n\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/wesclemens/Flask-JsonSchemaValidator", "keywords": "Flask jsonschema validation json", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "Flask-JsonSchemaValidator", "package_url": "https://pypi.org/project/Flask-JsonSchemaValidator/", "platform": "", "project_url": "https://pypi.org/project/Flask-JsonSchemaValidator/", "project_urls": { "Homepage": "https://github.com/wesclemens/Flask-JsonSchemaValidator" }, "release_url": "https://pypi.org/project/Flask-JsonSchemaValidator/0.3.0/", "requires_dist": [ "Flask (>=0.10.1)", "jsonschema (>=2.4.0)" ], "requires_python": "", "summary": "Basic JSON Schema Validator for the Flask web framework.", "version": "0.3.0" }, "last_serial": 5593009, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "e95b89f37a49f9f8de59c75092993151", "sha256": "5e65d42362281d08a4b8759ed0b0b4adeff9dea368e4a3f3bb1973e714aeb4df" }, "downloads": -1, "filename": "Flask-JsonSchemaValidator-0.1.tar.gz", "has_sig": false, "md5_digest": "e95b89f37a49f9f8de59c75092993151", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1111, "upload_time": "2015-08-27T04:46:05", "url": "https://files.pythonhosted.org/packages/9b/e4/96654b67763adabb1279367acce4c96ccc3b4532ca9946199d88117ee5a3/Flask-JsonSchemaValidator-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "960342f74afefc725e7915e714a20082", "sha256": "d306121776fee23bdabc07d2416e7c97935c2755e4d47a317c6e69bcc05173a8" }, "downloads": -1, "filename": "Flask-JsonSchemaValidator-0.2.tar.gz", "has_sig": false, "md5_digest": "960342f74afefc725e7915e714a20082", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 1747, "upload_time": "2015-08-28T04:40:10", "url": "https://files.pythonhosted.org/packages/85/9e/47e671a2bab37629e04f2e107749031ae169fb072efc78bfa09ddb3d0b7e/Flask-JsonSchemaValidator-0.2.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "eea98c5300e4ea3b140e07e4928c7d57", "sha256": "d9f619ffeb8bb68f4787e93e713afb7c4681c2dae37a81db744e1adaaad3250b" }, "downloads": -1, "filename": "Flask-JsonSchemaValidator-0.3.0.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "eea98c5300e4ea3b140e07e4928c7d57", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2672, "upload_time": "2019-07-27T13:23:47", "url": "https://files.pythonhosted.org/packages/0b/92/5100a0bd466cf3ed1401788a5fc6fd843ea6cd6d1860ed1d9fe327b044cb/Flask-JsonSchemaValidator-0.3.0.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "9dae6d32c806027df863fd3fa19cc01d", "sha256": "07f44cfcd16cd93a69ed3485b364c4a66e4df82871f9d6fff134f7497a7d6250" }, "downloads": -1, "filename": "Flask_JsonSchemaValidator-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9dae6d32c806027df863fd3fa19cc01d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4060, "upload_time": "2019-07-27T13:23:45", "url": "https://files.pythonhosted.org/packages/21/7f/3333d3d440ef2033fd105f1df976e98481a1808db547cfecdd616e14081e/Flask_JsonSchemaValidator-0.3.0-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "eea98c5300e4ea3b140e07e4928c7d57", "sha256": "d9f619ffeb8bb68f4787e93e713afb7c4681c2dae37a81db744e1adaaad3250b" }, "downloads": -1, "filename": "Flask-JsonSchemaValidator-0.3.0.linux-x86_64.tar.gz", "has_sig": false, "md5_digest": "eea98c5300e4ea3b140e07e4928c7d57", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2672, "upload_time": "2019-07-27T13:23:47", "url": "https://files.pythonhosted.org/packages/0b/92/5100a0bd466cf3ed1401788a5fc6fd843ea6cd6d1860ed1d9fe327b044cb/Flask-JsonSchemaValidator-0.3.0.linux-x86_64.tar.gz" }, { "comment_text": "", "digests": { "md5": "9dae6d32c806027df863fd3fa19cc01d", "sha256": "07f44cfcd16cd93a69ed3485b364c4a66e4df82871f9d6fff134f7497a7d6250" }, "downloads": -1, "filename": "Flask_JsonSchemaValidator-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9dae6d32c806027df863fd3fa19cc01d", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 4060, "upload_time": "2019-07-27T13:23:45", "url": "https://files.pythonhosted.org/packages/21/7f/3333d3d440ef2033fd105f1df976e98481a1808db547cfecdd616e14081e/Flask_JsonSchemaValidator-0.3.0-py2.py3-none-any.whl" } ] }