# flake8-flask-openapi-docstring
This Flake8 plugin will check if your Flask route's docstrings are valid OpenAPI spec.
Libraries like [APISpec](https://apispec.readthedocs.io/en/latest/) can generate OpenAPI spec from your Flask routes and docstrings and it's important to have present and in the correct format.
for example, this routes:
```python
@app.route("/hello", methods=["GET"])
def hello():
return "Hello World!"
```
will raise an error witht his plugin because not only the docstring is missing but also the OpenAPI spec is missing as well.
However these route:
```python
@app.route("/hello", methods=["GET"])
def hello():
"""
Returns a greeting
---
get:
responses:
200:
"""
return "Hello World!"
```
will not raise any error because the docstring is present and the OpenAPI spec is present as well.
Raw data
{
"_id": null,
"home_page": "https://github.com/expobrain/flake8-flask-openapi-docstring",
"name": "flake8-flask-openapi-docstring",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7,<3.12",
"maintainer_email": "",
"keywords": "",
"author": "Daniele Esposti",
"author_email": "daniele.esposti@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/8e/ac/00d35e5e3f21608a5bc7e32b982fb7a9153e9045137b55f14eaed52f9514/flake8_flask_openapi_docstring-0.1.2.tar.gz",
"platform": null,
"description": "# flake8-flask-openapi-docstring\n\nThis Flake8 plugin will check if your Flask route's docstrings are valid OpenAPI spec.\n\nLibraries like [APISpec](https://apispec.readthedocs.io/en/latest/) can generate OpenAPI spec from your Flask routes and docstrings and it's important to have present and in the correct format.\n\nfor example, this routes:\n\n```python\n@app.route(\"/hello\", methods=[\"GET\"])\ndef hello():\n return \"Hello World!\"\n```\n\nwill raise an error witht his plugin because not only the docstring is missing but also the OpenAPI spec is missing as well.\n\nHowever these route:\n\n```python\n@app.route(\"/hello\", methods=[\"GET\"])\ndef hello():\n \"\"\"\n Returns a greeting\n\n ---\n get:\n responses:\n 200:\n \"\"\"\n return \"Hello World!\"\n```\n\nwill not raise any error because the docstring is present and the OpenAPI spec is present as well.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "A Flake8 plugin to enforce OpenAPI docstrings in Flask routes",
"version": "0.1.2",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "52c611dd2a2b07e5f253ad85920032f9acd68c8279b960be60bf26dedef0e7ea",
"md5": "733d98e5dd76d1469f217d39b5b51043",
"sha256": "1899695080ec0f4785b5794acc92de849d8ce462d885ccb111b8cb54aa069e5e"
},
"downloads": -1,
"filename": "flake8_flask_openapi_docstring-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "733d98e5dd76d1469f217d39b5b51043",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7,<3.12",
"size": 5111,
"upload_time": "2023-01-13T12:30:11",
"upload_time_iso_8601": "2023-01-13T12:30:11.486806Z",
"url": "https://files.pythonhosted.org/packages/52/c6/11dd2a2b07e5f253ad85920032f9acd68c8279b960be60bf26dedef0e7ea/flake8_flask_openapi_docstring-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8eac00d35e5e3f21608a5bc7e32b982fb7a9153e9045137b55f14eaed52f9514",
"md5": "16393016cda6c430f0dc293203384447",
"sha256": "f2c8c68271c48a56905956abd18a99b967bd5e88431252ad0251bbeda28483e6"
},
"downloads": -1,
"filename": "flake8_flask_openapi_docstring-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "16393016cda6c430f0dc293203384447",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7,<3.12",
"size": 3962,
"upload_time": "2023-01-13T12:30:12",
"upload_time_iso_8601": "2023-01-13T12:30:12.760162Z",
"url": "https://files.pythonhosted.org/packages/8e/ac/00d35e5e3f21608a5bc7e32b982fb7a9153e9045137b55f14eaed52f9514/flake8_flask_openapi_docstring-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-13 12:30:12",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "expobrain",
"github_project": "flake8-flask-openapi-docstring",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "flake8-flask-openapi-docstring"
}