{ "info": { "author": "Anton Shabouta", "author_email": "zloyusr@gmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# Sanic OpenAPI v3\n\n[![Build Status](https://travis-ci.org/zloyuser/sanic-openapi3.svg?branch=master)](https://travis-ci.org/zloyuser/sanic-openapi3)\n[![PyPI](https://img.shields.io/pypi/v/sanic-openapi3.svg)](https://pypi.python.org/pypi/sanic-openapi3/)\n[![PyPI](https://img.shields.io/pypi/pyversions/sanic-openapi3.svg)](https://pypi.python.org/pypi/sanic-openapi3/)\n\nGive your Sanic API an OpenAPI v3 specification.\nBased on original [Sanic OpenAPI](https://github.com/channelcat/sanic-openapi) extension.\n\n## Installation\n\n```shell\npip install sanic-openapi3\n```\n\n## Usage\n\n### Import blueprint and use simple decorators to document routes:\n\n```python\nfrom sanic_openapi3 import openapi, openapi_blueprint\n\n@app.get(\"/user/\")\n@openapi.summary(\"Fetches a user by ID\")\n@openapi.response(200, { \"user\": { \"name\": str, \"id\": int } })\nasync def get_user(request, user_id):\n ...\n\n@app.post(\"/user\")\n@openapi.summary(\"Creates a user\")\n@openapi.body({\"user\": { \"name\": str }})\nasync def create_user(request):\n ...\n\napp.blueprint(openapi_blueprint)\n```\n\nYou'll now have a specification at the URL `/openapi.json`.\nYour routes will be automatically categorized by their blueprints.\n\n### Model your input/output\n\n```python\nclass Car:\n make = str\n model = str\n year = int\n\nclass Garage:\n spaces = int\n cars = [Car]\n\n@app.get(\"/garage\")\n@openapi.summary(\"Gets the whole garage\")\n@openapi.response(200, Garage)\nasync def get_garage(request):\n return json({\n \"spaces\": 2,\n \"cars\": [{\"make\": \"Nissan\", \"model\": \"370Z\"}]\n })\n\n```\n\n### Get more descriptive\n\n```python\nclass Car:\n make = doc.String(\"Who made the car\")\n model = doc.String(\"Type of car. This will vary by make\")\n year = doc.Integer(\"4-digit year of the car\", required=False)\n\nclass Garage:\n spaces = doc.Integer(\"How many cars can fit in the garage\")\n cars = doc.List(Car, description=\"All cars in the garage\")\n```\n\n### Configure all the things\n\n```python\napp.config.OPENAPI_VERSION = '1.0.0'\napp.config.OPENAPI_TITLE = 'Car API'\napp.config.OPENAPI_DESCRIPTION = 'Car API'\napp.config.OPENAPI_TERMS_OF_SERVICE = 'https://example.com/terms'\napp.config.OPENAPI_CONTACT_EMAIL = 'mail@example.com'\napp.config.OPENAPI_CONTACT_NAME = 'mail@example.com'\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/zloyuser/sanic-openapi3", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "sanic-openapi3", "package_url": "https://pypi.org/project/sanic-openapi3/", "platform": "", "project_url": "https://pypi.org/project/sanic-openapi3/", "project_urls": { "Homepage": "https://github.com/zloyuser/sanic-openapi3" }, "release_url": "https://pypi.org/project/sanic-openapi3/0.0.2/", "requires_dist": null, "requires_python": "", "summary": "OpenAPI v3 support for Sanic", "version": "0.0.2" }, "last_serial": 3924818, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "247c134d3e4dca6ac32fd834206a84ca", "sha256": "69fd38e4ffd711715f56bafe820df8362b51d47e4e0cdf88103585c8202fd303" }, "downloads": -1, "filename": "sanic_openapi3-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "247c134d3e4dca6ac32fd834206a84ca", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 6135, "upload_time": "2018-05-28T18:44:18", "url": "https://files.pythonhosted.org/packages/7c/3b/4d298063f3b594c0dcd40943ec3f873cdfcc88e44bee7bae8c5211e43048/sanic_openapi3-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d3ebd150207988b5c161e0f83dd44e19", "sha256": "8dd73600db196ecfec6e95287a95183fbfb4f4cfa57d2d431301bb08d4309710" }, "downloads": -1, "filename": "sanic-openapi3-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d3ebd150207988b5c161e0f83dd44e19", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5181, "upload_time": "2018-05-28T18:44:20", "url": "https://files.pythonhosted.org/packages/54/68/3bd0426178e1038a2c6835d5ab6eb154c8ad240b4442b6653f8225ac61ce/sanic-openapi3-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "7f9a10453e4cfc9c57da423b0a04ecde", "sha256": "76ddfcd24e087bdaa7c662f76aa88792211623672e895759a299cf406d3b08e4" }, "downloads": -1, "filename": "sanic_openapi3-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7f9a10453e4cfc9c57da423b0a04ecde", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8090, "upload_time": "2018-06-03T07:19:12", "url": "https://files.pythonhosted.org/packages/53/de/941491e368c6e307694c70adc3becae83633e39a45c9e41a7e849ab28345/sanic_openapi3-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1611b5310086c0ad140ce7e976249adf", "sha256": "3e93ed8390fa54c6695817a0f4b6ba415bea837850f921718d2cec9c3785130b" }, "downloads": -1, "filename": "sanic-openapi3-0.0.2.tar.gz", "has_sig": false, "md5_digest": "1611b5310086c0ad140ce7e976249adf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5666, "upload_time": "2018-06-03T07:19:13", "url": "https://files.pythonhosted.org/packages/99/37/3a136e8c7a9465d05166d48a3e90d7d23dabdab9cebb426d8f557474fd7b/sanic-openapi3-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7f9a10453e4cfc9c57da423b0a04ecde", "sha256": "76ddfcd24e087bdaa7c662f76aa88792211623672e895759a299cf406d3b08e4" }, "downloads": -1, "filename": "sanic_openapi3-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "7f9a10453e4cfc9c57da423b0a04ecde", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8090, "upload_time": "2018-06-03T07:19:12", "url": "https://files.pythonhosted.org/packages/53/de/941491e368c6e307694c70adc3becae83633e39a45c9e41a7e849ab28345/sanic_openapi3-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1611b5310086c0ad140ce7e976249adf", "sha256": "3e93ed8390fa54c6695817a0f4b6ba415bea837850f921718d2cec9c3785130b" }, "downloads": -1, "filename": "sanic-openapi3-0.0.2.tar.gz", "has_sig": false, "md5_digest": "1611b5310086c0ad140ce7e976249adf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5666, "upload_time": "2018-06-03T07:19:13", "url": "https://files.pythonhosted.org/packages/99/37/3a136e8c7a9465d05166d48a3e90d7d23dabdab9cebb426d8f557474fd7b/sanic-openapi3-0.0.2.tar.gz" } ] }